diff options
author | Peter Jones <pjones@redhat.com> | 2015-06-23 11:14:39 -0400 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-02-21 16:01:03 +0200 |
commit | 6caca84c904423fbe75674c1589f3457c4927281 (patch) | |
tree | b9233f484424ba65b23a86cb3d6b639b2b5f8f87 /build/parsePrep.c | |
parent | c8865bffaba432e3a6064cfecb1f263646a0bcaa (diff) | |
download | rpm-6caca84c904423fbe75674c1589f3457c4927281.tar.gz |
Make %{buildsubdir} more independent of %setup
Use the macro itself as ground truth and no longer store it in the spec object.
This may allow implementing %setup as a proper macro in the future.
Co-authord-by: Florian Festi <ffesti@redhat.com>
Diffstat (limited to 'build/parsePrep.c')
-rw-r--r-- | build/parsePrep.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index 707d0a6ee..1a3a32ab0 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -297,13 +297,15 @@ static int doSetupMacro(rpmSpec spec, const char *line) } if (dirName) { - spec->buildSubdir = xstrdup(dirName); + rpmPushMacro(spec->macros, "buildsubdir", NULL, dirName, RMIL_SPEC); } else { - rasprintf(&spec->buildSubdir, "%s-%s", + char * buildSubdir = NULL; + rasprintf(&buildSubdir, "%s-%s", headerGetString(spec->packages->header, RPMTAG_NAME), headerGetString(spec->packages->header, RPMTAG_VERSION)); + rpmPushMacro(spec->macros, "buildsubdir", NULL, buildSubdir, RMIL_SPEC); + free(buildSubdir); } - rpmPushMacroFlags(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC, RPMMACRO_LITERAL); /* cd to the build dir */ { char * buildDir = rpmGenPath(spec->rootDir, "%{_builddir}", ""); @@ -316,7 +318,7 @@ static int doSetupMacro(rpmSpec spec, const char *line) /* delete any old sources */ if (!leaveDirs) { - rasprintf(&buf, "rm -rf '%s'", spec->buildSubdir); + buf = rpmExpand("rm -rf '%{buildsubdir}'", NULL); appendLineStringBuf(spec->prep, buf); free(buf); } @@ -325,8 +327,8 @@ static int doSetupMacro(rpmSpec spec, const char *line) /* if necessary, create and cd into the proper dir */ if (createDir) { - buf = rpmExpand("%{__mkdir_p} ", spec->buildSubdir, "\n", - "cd '", spec->buildSubdir, "'", NULL); + buf = rpmExpand("%{__mkdir_p} '%{buildsubdir}'\n", + "cd '%{buildsubdir}'", NULL); appendLineStringBuf(spec->prep, buf); free(buf); } @@ -341,7 +343,7 @@ static int doSetupMacro(rpmSpec spec, const char *line) } if (!createDir) { - rasprintf(&buf, "cd '%s'", spec->buildSubdir); + buf = rpmExpand("cd '%{buildsubdir}'", NULL); appendLineStringBuf(spec->prep, buf); free(buf); } |