[Rpm-maint] [rpm-software-management/rpm] Dynamic Build Dependencies (#593)

Igor Gnatenko notifications at github.com
Wed Apr 10 06:56:29 UTC 2019


```diff
diff --git a/build/build.c b/build/build.c
index c99028dd9..b71e63176 100644
--- a/build/build.c
+++ b/build/build.c
@@ -273,9 +273,8 @@ static rpmRC doBuildRequires(rpmSpec spec, int test) {
 
     rpmdsPutToHeader(*packageDependencies(spec->sourcePackage, RPMTAG_REQUIRENAME), spec->sourcePackage->header);
 
-    if (rc == 0) {
-	parseRCPOT(spec, spec->sourcePackage, "DynamicBuildRequires = 4.15", RPMTAG_PROVIDENAME, 0, 0, addReqProvPkg , NULL);
-    }
+    parseRCPOT(spec, spec->sourcePackage, "DynamicBuildRequires = 4.15", RPMTAG_PROVIDENAME, 0, 0, addReqProvPkg , NULL);
+    rc = RPMRC_MISSINGBUILDREQUIRES;
 
  exit:
     free(argv);
@@ -363,10 +362,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
 		goto exit;
 
 	if ((what & RPMBUILD_BUILDREQUIRES) &&
-            (rc = doBuildRequires(spec, test)))
-	    goto exit;
-	if ((what & RPMBUILD_CHECKBUILDREQUIRES) &&
-            (rc = doCheckBuildRequires(spec, test))) {
+            (rc = doBuildRequires(spec, test))) {
 	    if (rc == RPMRC_MISSINGBUILDREQUIRES) {
 		/* Create buildreqs package */
 		char *nvr = headerGetAsString(spec->packages->header, RPMTAG_NVR);
@@ -385,6 +381,9 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
 	    } else {
                 goto exit;
 	    }
+	if ((what & RPMBUILD_CHECKBUILDREQUIRES) &&
+            (rc = doCheckBuildRequires(spec, test)))
+	    goto exit;
 	}
 	if ((what & RPMBUILD_BUILD) &&
 	    (rc = doScript(spec, RPMBUILD_BUILD, "%build",
diff --git a/rpmbuild.c b/rpmbuild.c
index 1e464eeaf..845ae5aa5 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -672,7 +672,8 @@ int main(int argc, char *argv[])
     case 'r':
 	ba->buildAmount |= RPMBUILD_PREP;
 	ba->buildAmount |= RPMBUILD_BUILDREQUIRES;
-	ba->buildAmount |= RPMBUILD_CHECKBUILDREQUIRES;
+	if (!noDeps)
+	    ba->buildAmount |= RPMBUILD_CHECKBUILDREQUIRES;
     case 's':
 	ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
 	break;
```

This is what I'm thinking about. mock will run `rpmbuild -br spec --nodeps`, check return code (if it is 11, then buildreqs.nosrc.rpm was written, so it will install deps), then rerun with `rpmbuild -bb spec --nodeps`. So RPM won't check generated BuildRequires.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/593#issuecomment-481559400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190409/b19723f7/attachment.html>


More information about the Rpm-maint mailing list