summaryrefslogtreecommitdiff
path: root/build/parseSpec.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-08-06 12:24:34 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-08-06 12:24:34 +0300
commit6c0651926aedc302816a0b61e1f1a8ef568be539 (patch)
treeff07e6c5835661795c93ccdb7869ec9d717887fa /build/parseSpec.c
parentedf4e046ec5a1c7e07ad390f806fdca2a758f0d5 (diff)
downloadlibrpm-tizen-6c0651926aedc302816a0b61e1f1a8ef568be539.tar.gz
librpm-tizen-6c0651926aedc302816a0b61e1f1a8ef568be539.tar.bz2
librpm-tizen-6c0651926aedc302816a0b61e1f1a8ef568be539.zip
Simplify spec buildroot hysteria
- BuildRoot: in spec is now really ignored - parseSpec() uses default %{buildroot} unless overridden - BuildRoot is forced for all builds
Diffstat (limited to 'build/parseSpec.c')
-rw-r--r--build/parseSpec.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 833eae05b..098bd2b0e 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -424,28 +424,23 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
/* Set up a new Spec structure with no packages. */
spec = newSpec();
- /*
- * Note: rpmGetPath should guarantee a "canonical" path. That means
- * that the following pathologies should be weeded out:
- * //bin//sh
- * //usr//bin/
- * /.././../usr/../bin//./sh (XXX FIXME: dots not handled yet)
- */
spec->specFile = rpmGetPath(specFile, NULL);
spec->fileStack = newOpenFileInfo();
spec->fileStack->fileName = xstrdup(spec->specFile);
+ /* If buildRoot not specified, use default %{buildroot} */
if (buildRoot) {
- if (*buildRoot == '\0') {
- rpmlog(RPMLOG_ERR, _("BuildRoot couldn't be empty\n"));
- goto errxit;
- }
- if (!strcmp(buildRoot, "/")) {
- rpmlog(RPMLOG_ERR, _("BuildRoot can not be \"/\"\n"));
- goto errxit;
- }
- spec->gotBuildRoot = 1;
spec->buildRoot = xstrdup(buildRoot);
- addMacro(spec->macros, "buildroot", NULL, buildRoot, RMIL_SPEC);
+ } else {
+ spec->buildRoot = rpmGetPath("%{?buildroot:%{buildroot}}", NULL);
+ }
+ addMacro(spec->macros, "buildroot", NULL, spec->buildRoot, RMIL_SPEC);
+ if (*spec->buildRoot == '\0') {
+ rpmlog(RPMLOG_ERR, _("BuildRoot couldn't be empty\n"));
+ goto errxit;
+ }
+ if (!strcmp(spec->buildRoot, "/")) {
+ rpmlog(RPMLOG_ERR, _("BuildRoot can not be \"/\"\n"));
+ goto errxit;
}
addMacro(NULL, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
spec->recursing = recursing;