From: Jindrich Novy Date: Mon, 1 Sep 2008 12:35:34 +0000 (+0200) Subject: Create directory structure for rpmbuild prior to build if it doesn't exist X-Git-Tag: tznext/4.11.0.1.tizen20130304~3649 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff7bfd9a32d672f8582ea334ee351af8c32229ad;p=tools%2Flibrpm-tizen.git Create directory structure for rpmbuild prior to build if it doesn't exist - creates all needed directories that rpmbuild uses for input and output --- diff --git a/build.c b/build.c index faa09c5..83aaf20 100644 --- a/build.c +++ b/build.c @@ -16,6 +16,7 @@ #include #include #include +#include #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; }