[Rpm-maint] [PATCH v3] Allow '--short-circuit' for '-bb'

Michal Schmidt mschmidt at redhat.com
Wed Jun 23 12:37:56 UTC 2010


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
---

diff --git a/build/pack.c b/build/pack.c
index c7622cc..f2f76bd 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -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;
diff --git a/doc/rpmbuild.8 b/doc/rpmbuild.8
index 6ad5bf1..5432608 100644
--- a/doc/rpmbuild.8
+++ b/doc/rpmbuild.8
@@ -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
diff --git a/rpmqv.c b/rpmqv.c
index be2707c..6104e2f 100644
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -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;


More information about the Rpm-maint mailing list