summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2008-09-01 14:35:34 +0200
committerJindrich Novy <jnovy@redhat.com>2008-09-01 14:35:34 +0200
commitff7bfd9a32d672f8582ea334ee351af8c32229ad (patch)
treed4a694f065e7286414d393797f3439c152a88216 /build.c
parentb16df5b3089e36cf0bd697177983dcae11b849ec (diff)
downloadlibrpm-tizen-ff7bfd9a32d672f8582ea334ee351af8c32229ad.tar.gz
librpm-tizen-ff7bfd9a32d672f8582ea334ee351af8c32229ad.tar.bz2
librpm-tizen-ff7bfd9a32d672f8582ea334ee351af8c32229ad.zip
Create directory structure for rpmbuild prior to build if it doesn't exist
- creates all needed directories that rpmbuild uses for input and output
Diffstat (limited to 'build.c')
-rw-r--r--build.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/build.c b/build.c
index faa09c557..83aaf201e 100644
--- a/build.c
+++ b/build.c
@@ -16,6 +16,7 @@
#include <rpm/rpmts.h>
#include <rpm/rpmfileutil.h>
#include <rpm/rpmlog.h>
+#include <lib/misc.h>
#include "build.h"
#include "debug.h"
@@ -253,6 +254,28 @@ 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;
}