From aa509e3c5e68ed905a80743bd3e8f3e26aa67590 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 10 Oct 2008 14:42:34 +0300 Subject: 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 --- build.c | 28 ++++++---------------------- 1 file 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; } -- cgit v1.2.1