2 * \file build/parseBuildInstallClean.c
3 * Parse %build/%install/%clean section from spec file.
7 #include <rpm/rpmlog.h>
8 #include "build/rpmbuild_internal.h"
12 int parseBuildInstallClean(rpmSpec spec, int parsePart)
14 int nextPart, rc, res = PART_ERROR;
15 StringBuf *sbp = NULL;
16 const char *name = NULL;
18 if (parsePart == PART_BUILD) {
21 } else if (parsePart == PART_INSTALL) {
22 sbp = &(spec->install);
24 } else if (parsePart == PART_CHECK) {
27 } else if (parsePart == PART_CLEAN) {
31 goto exit; /* programmer error */
35 rpmlog(RPMLOG_ERR, _("line %d: second %s\n"),
40 *sbp = newStringBuf();
42 /* There are no options to %build, %install, %check, or %clean */
43 if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
50 if (parsePart == PART_BUILD) {
52 "if [[ $RPM_ARCH == \"aarch64\" ]]; then\n"
54 "for s in guess sub; do\n"
55 " for c in $(find -maxdepth 8 -name \"config.$s\"); do\n"
56 " grep -q config-patches@ $c || continue\n"
57 " grep -q aarch64 $c || install -m 755 $ref/config.$s $c\n"
58 " grep -q ppc64le $c || install -m 755 $ref/config.$s $c\n"
63 appendLineStringBuf(*sbp, buf);
67 while (! (nextPart = isPart(spec->line))) {
68 appendStringBuf(*sbp, spec->line);
69 if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {