Panu Matilainen fc8564
commit 7a813e149fe40bbb9beee7dbf9898ab0c1906da2
Panu Matilainen fc8564
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen fc8564
Date:   Sun Mar 8 11:33:22 2009 +0200
Panu Matilainen fc8564
Panu Matilainen fc8564
    Load macros before creating directories (rhbz#489104)
Panu Matilainen fc8564
    - %_sourcedir and friends can have things like %{name}, load macros
Panu Matilainen fc8564
      before trying to create any directories when installing src.rpms
Panu Matilainen fc8564
    (cherry picked from commit ac7c3412278a03da6633758bca999827d4b59038)
Panu Matilainen fc8564
Panu Matilainen fc8564
diff --git a/lib/psm.c b/lib/psm.c
Panu Matilainen fc8564
index 3b2fd7c..112d344 100644
Panu Matilainen fc8564
--- a/lib/psm.c
Panu Matilainen fc8564
+++ b/lib/psm.c
Panu Matilainen fc8564
@@ -275,6 +275,9 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
Panu Matilainen fc8564
     if (rootdir && strcmp(rootdir, "/") == 0)
Panu Matilainen fc8564
 	rootdir = NULL;
Panu Matilainen fc8564
 
Panu Matilainen fc8564
+    /* Macros need to be added before trying to create directories */
Panu Matilainen fc8564
+    rpmInstallLoadMacros(h);
Panu Matilainen fc8564
+
Panu Matilainen fc8564
     if (specix >= 0) {
Panu Matilainen fc8564
 	const char *bn;
Panu Matilainen fc8564
 
Panu Matilainen fc8564
@@ -301,8 +304,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
Panu Matilainen fc8564
 	goto exit;
Panu Matilainen fc8564
     }
Panu Matilainen fc8564
 
Panu Matilainen fc8564
-    rpmInstallLoadMacros(h);
Panu Matilainen fc8564
-
Panu Matilainen fc8564
     te = rpmtsElement(ts, 0);
Panu Matilainen fc8564
     if (te == NULL) {	/* XXX can't happen */
Panu Matilainen fc8564
 	goto exit;