Detect short-circuited build based on executed build steps from buildSpec()
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 2 Sep 2010 08:01:15 +0000 (11:01 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 2 Sep 2010 08:16:07 +0000 (11:16 +0300)
- Avoids having to access rpmBTArgs from deep packageBinaries(),
  API changing is not an issue anymore...

build/build.c
build/pack.c
build/rpmbuild_internal.h

index 0584dcf..cab152b 100644 (file)
@@ -234,6 +234,8 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
            }
        }
     } else {
+       int didBuild = (what & (RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL));
+
        if ((what & RPMBUILD_PREP) &&
            (rc = doScript(spec, RPMBUILD_PREP, NULL, NULL, test)))
                goto exit;
@@ -268,7 +270,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
                return rc;
 
        if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
-           (rc = packageBinaries(spec, cookie)))
+           (rc = packageBinaries(spec, cookie, (didBuild == 0))))
                goto exit;
        
        if ((what & RPMBUILD_CLEAN) &&
index 8e0c868..fa4b4ef 100644 (file)
@@ -668,7 +668,7 @@ static rpmRC checkPackages(char *pkgcheck)
     return RPMRC_OK;
 }
 
-rpmRC packageBinaries(rpmSpec spec, const char *cookie)
+rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
 {
     struct cpioSourceArchive_s csabuf;
     CSA_t csa = &csabuf;
@@ -705,7 +705,7 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie)
            headerPutBin(pkg->header, RPMTAG_SOURCEPKGID, spec->sourcePkgId,16);
        }
 
-       if (rpmBTArgs.shortCircuit) {
+       if (cheating) {
            (void) rpmlibNeedsFeature(pkg->header, "ShortCircuited", "4.9.0-1");
        }
        
index 0b17496..93fcdd4 100644 (file)
@@ -285,10 +285,11 @@ int processSourceFiles(rpmSpec spec);
  * Generate binary package(s).
  * @param spec         spec file control structure
  * @param cookie       build identifier "cookie" or NULL
+ * @param cheating     was build shortcircuited?
  * @return             RPMRC_OK on success
  */
 RPM_GNUC_INTERNAL
-rpmRC packageBinaries(rpmSpec spec, const char *cookie);
+rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating);
 
 /** \ingroup rpmbuild
  * Generate source package.