From ff7bfd9a32d672f8582ea334ee351af8c32229ad Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Mon, 1 Sep 2008 14:35:34 +0200 Subject: [PATCH] Create directory structure for rpmbuild prior to build if it doesn't exist - creates all needed directories that rpmbuild uses for input and output --- build.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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; } -- 2.7.4