From: Jindrich Novy Date: Sun, 11 Jan 2009 15:54:07 +0000 (+0100) Subject: Don't check package BuildRequires when doing --rmsource (rhbz#452477) X-Git-Tag: tznext/4.11.0.1.tizen20130304~3209 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e58db2eda1609a8b48d8248390a2d87ff99fdd6d;p=tools%2Flibrpm-tizen.git Don't check package BuildRequires when doing --rmsource (rhbz#452477) - export doRmSource() and make it more consistent with the API --- diff --git a/build.c b/build.c index 3891b2a..48e579d 100644 --- a/build.c +++ b/build.c @@ -259,6 +259,13 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) goto exit; } + if ( ba->buildAmount&RPMBUILD_RMSOURCE && !(ba->buildAmount&~(RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)) ) { + rc = doRmSource(spec); + if ( rc == RPMRC_OK && ba->buildAmount&RPMBUILD_RMSPEC ) + rc = unlink(specFile); + goto exit; + } + /* Assemble source header from parsed components */ initSourceHeader(spec); diff --git a/build/build.c b/build/build.c index 45e9b10..a4a271a 100644 --- a/build/build.c +++ b/build/build.c @@ -15,17 +15,18 @@ static int _build_debug = 0; /** */ -static void doRmSource(rpmSpec spec) +rpmRC doRmSource(rpmSpec spec) { struct Source *p; Package pkg; - int rc; + int rc = 0; for (p = spec->sources; p != NULL; p = p->next) { if (! (p->flags & RPMBUILD_ISNO)) { char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); rc = unlink(fn); fn = _free(fn); + if (rc) goto exit; } } @@ -35,9 +36,12 @@ static void doRmSource(rpmSpec spec) char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL); rc = unlink(fn); fn = _free(fn); + if (rc) goto exit; } } } +exit: + return !rc ? RPMRC_OK : RPMRC_FAIL; } /* diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 0ba3c7e..acea095 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -273,6 +273,13 @@ int parseExpressionBoolean(rpmSpec spec, const char * expr); char * parseExpressionString(rpmSpec spec, const char * expr); /** \ingroup rpmbuild + * Remove all sources assigned to spec file. + * + * @param spec spec file control structure + * @return RPMRC_OK on success + */ +rpmRC doRmSource(rpmSpec spec); +/** \ingroup rpmbuild * Run a build script, assembled from spec file scriptlet section. * * @param spec spec file control structure