Don't check package BuildRequires when doing --rmsource (rhbz#452477)

- export doRmSource() and make it more consistent with the API
This commit is contained in:
Jindrich Novy 2009-01-11 16:54:07 +01:00
parent 1909784075
commit e58db2eda1
3 changed files with 20 additions and 2 deletions

View File

@ -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);

View File

@ -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;
}
/*

View File

@ -272,6 +272,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.
*