Allow '--short-circuit' for '-bb'

This patch allows short-circuiting of building binary packages. To
prevent accidental use of short-circuited rpms, they are marked with
an unsatisfiable dependency "rpmlib(ShortCircuited)". A developer using
this feature for local development and testing will use "--nodeps".
Should such a rpm leak into the world, users will quickly notice
it does not install by default.

(v3: avoids API change, suggested by Panu Matilainen.
 v2: added poisoning with unsatisfiable dependency.)

Michal
This commit is contained in:
Michal Schmidt 2010-06-23 14:37:56 +02:00 committed by Panu Matilainen
parent b6adef396b
commit 7583fcc341
3 changed files with 10 additions and 2 deletions

View File

@ -753,6 +753,10 @@ rpmRC packageBinaries(rpmSpec spec)
if (spec->sourcePkgId != NULL) {
headerPutBin(pkg->header, RPMTAG_SOURCEPKGID, spec->sourcePkgId,16);
}
if (rpmBTArgs.shortCircuit) {
(void) rpmlibNeedsFeature(pkg->header, "ShortCircuited", "4.9.0-1");
}
{ char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
char *binRpm, *binDir;

View File

@ -170,8 +170,10 @@ used standalone, eg. "\fBrpmbuild\fR \fB--rmspec foo.spec\fR").
.TP
\fB--short-circuit\fR
Skip straight to specified stage (i.e., skip all stages leading
up to the specified stage). Only valid with \fB-bc\fR
and \fB-bi\fR.
up to the specified stage). Only valid with \fB-bc\fR, \fB-bi\fR,
and \fB-bb\fR. Useful for local testing only. Packages built this
way will be marked with an unsatisfiable dependency to prevent
their accidental use.
.TP
\fB--sign\fR
Embed a GPG signature in the package. This signature can be used

View File

@ -660,6 +660,8 @@ int main(int argc, char *argv[])
case 'b':
ba->buildAmount |= RPMBUILD_PACKAGEBINARY;
ba->buildAmount |= RPMBUILD_CLEAN;
if ((ba->buildChar == 'b') && ba->shortCircuit)
break;
case 'i':
ba->buildAmount |= RPMBUILD_INSTALL;
ba->buildAmount |= RPMBUILD_CHECK;