Blob Blame History Raw
commit 7a813e149fe40bbb9beee7dbf9898ab0c1906da2
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Sun Mar 8 11:33:22 2009 +0200

    Load macros before creating directories (rhbz#489104)
    - %_sourcedir and friends can have things like %{name}, load macros
      before trying to create any directories when installing src.rpms
    (cherry picked from commit ac7c3412278a03da6633758bca999827d4b59038)

diff --git a/lib/psm.c b/lib/psm.c
index 3b2fd7c..112d344 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -275,6 +275,9 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
     if (rootdir && strcmp(rootdir, "/") == 0)
 	rootdir = NULL;
 
+    /* Macros need to be added before trying to create directories */
+    rpmInstallLoadMacros(h);
+
     if (specix >= 0) {
 	const char *bn;
 
@@ -301,8 +304,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
 	goto exit;
     }
 
-    rpmInstallLoadMacros(h);
-
     te = rpmtsElement(ts, 0);
     if (te == NULL) {	/* XXX can't happen */
 	goto exit;