summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-10-10 14:42:34 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-10-10 14:42:34 +0300
commitaa509e3c5e68ed905a80743bd3e8f3e26aa67590 (patch)
tree6cf22fe5f0a745df42c31e5ad0a0ca35ff87f739
parentc17dffb6fbf8c123516ed1ca06a35beca1c7d8c7 (diff)
downloadrpm-aa509e3c5e68ed905a80743bd3e8f3e26aa67590.tar.gz
Use rpmMkdirs() to create the entire build tree in buildForTarget()
- also move the build tree generation earlier to have it automatically created for tarbuilds too
-rw-r--r--build.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/build.c b/build.c
index 83aaf201e..800632fce 100644
--- a/build.c
+++ b/build.c
@@ -186,6 +186,12 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (ba->buildRootOverride)
buildRootURL = rpmGenPath(NULL, ba->buildRootOverride, NULL);
+ /* Create build tree if necessary */
+ const char * buildtree = "%{_topdir}:%{_specdir}:%{_sourcedir}:%{_builddir}:%{_rpmdir}:%{_srcrpmdir}:%{_buildrootdir}";
+ if (rpmMkdirs(rpmtsRootDir(ts), buildtree)) {
+ goto exit;
+ }
+
if (ba->buildMode == 't') {
char *srcdir = NULL, *dir;
@@ -254,28 +260,6 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
goto exit;
}
- /* Be sure all required directories exist, attempt to create them if not */
- {
- char *_topdir = rpmGenPath(rpmtsRootDir(ts), "%{_topdir}", ""),
- *_builddir = rpmGenPath(rpmtsRootDir(ts), "%{_builddir}", ""),
- *_buildrootdir = rpmGenPath(rpmtsRootDir(ts), "%{_buildrootdir}", ""),
- *_sourcedir = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", ""),
- *_rpmdir = rpmGenPath(rpmtsRootDir(ts), "%{_rpmdir}", ""),
- *_specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", ""),
- *_srcrpmdir = rpmGenPath(rpmtsRootDir(ts), "%{_srcrpmdir}", "");
-
- if ( rpmMkdirPath(_topdir, "_topdir") ||
- rpmMkdirPath(_builddir, "_builddir") ||
- rpmMkdirPath(_buildrootdir, "_buildrootdir") ||
- rpmMkdirPath(_sourcedir, "_sourcedir") ||
- rpmMkdirPath(_rpmdir, "_rpmdir") ||
- rpmMkdirPath(_specdir, "_specdir") ||
- rpmMkdirPath(_srcrpmdir, "_srcrpmdir")
- ) {
- goto exit;
- }
- }
-
if (buildSpec(ts, spec, buildAmount, ba->noBuild)) {
goto exit;
}