Fix build tree creation with relative paths for %_topdir and friends
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 21 Nov 2008 08:04:41 +0000 (10:04 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 21 Nov 2008 08:04:41 +0000 (10:04 +0200)
- rpmtsRootDir() gives "/" even if root not actually set which makes sense
  for most operations but not when we're creating build directories

build.c
lib/psm.c

diff --git a/build.c b/build.c
index 800632f..e026b13 100644 (file)
--- a/build.c
+++ b/build.c
@@ -188,7 +188,8 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
 
     /* Create build tree if necessary */
     const char * buildtree = "%{_topdir}:%{_specdir}:%{_sourcedir}:%{_builddir}:%{_rpmdir}:%{_srcrpmdir}:%{_buildrootdir}";
-    if (rpmMkdirs(rpmtsRootDir(ts), buildtree)) {
+    const char * rootdir = rpmtsRootDir(ts);
+    if (rpmMkdirs(strcmp(rootdir, "/") ? rootdir : NULL , buildtree)) {
        goto exit;
     }
 
index 35883c5..a88e059 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -220,6 +220,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
 {
     rpmfi fi = NULL;
     char * specFile = NULL;
+    const char *rootdir = rpmtsRootDir(ts);
     Header h = NULL;
     rpmpsm psm = NULL;
     rpmte te = NULL;
@@ -271,6 +272,9 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
        }
     }
 
+    if (strcmp(rootdir, "/") == 0)
+       rootdir = NULL;
+
     if (specix >= 0) {
        const char *bn;