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
This commit is contained in:
Panu Matilainen 2008-10-10 14:42:34 +03:00
parent c17dffb6fb
commit aa509e3c5e
1 changed files with 6 additions and 22 deletions

28
build.c
View File

@ -186,6 +186,12 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (ba->buildRootOverride) if (ba->buildRootOverride)
buildRootURL = rpmGenPath(NULL, ba->buildRootOverride, NULL); 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') { if (ba->buildMode == 't') {
char *srcdir = NULL, *dir; char *srcdir = NULL, *dir;
@ -254,28 +260,6 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
goto exit; 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)) { if (buildSpec(ts, spec, buildAmount, ba->noBuild)) {
goto exit; goto exit;
} }