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) {
54 "case $(uname -m) in\n"
55 " aarch64) mints=20120610;;\n"
56 " ppc64le) mints=20130610;;\n"
57 " riscv64) mints=20160911;;\n"
59 "for s in guess sub; do\n"
60 " for c in $(find -maxdepth 8 -name \"config.$s\"); do\n"
61 " grep -q config-patches@ $c || continue\n"
62 " timestamp=$(sed -n \"/^timestamp=/{s///;s/[-'\\\"]//g;p;q;}\" $c)\n"
63 " test -n \"$timestamp\" || timestamp=0\n"
64 " test $timestamp -ge $mints || install -m 755 $ref/config.$s $c\n"
68 appendLineStringBuf(*sbp, buf);
72 while (! (nextPart = isPart(spec->line))) {
73 appendStringBuf(*sbp, spec->line);
74 if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {