A new user interface for you! Read more...

File parallelbinaries1.patch of Package rpm

commit eabc37e9e9d5a112bb8dcc11dc36cf51c4c9b888
Author: Simon Lees <sflees@suse.de>
Date:   Wed Sep 12 16:54:22 2018 +0930

    Split processBinary into a separate function

diff --git a/build/files.c b/build/files.c
index ca3e4a9e1..26013b138 100644
--- a/build/files.c
+++ b/build/files.c
@@ -3023,6 +3023,76 @@ static void addPackageDeps(Package from, Package to, enum rpmTag_e tag)
     free(evr);
 }
 
+static rpmRC processBinary(rpmSpec spec, Package pkg, rpmBuildPkgFlags pkgFlags,
+            int didInstall, int test, Package maindbg, char *buildroot, Package dbgsrcpkg,
+            char *uniquearch)
+{
+    Package deplink = NULL;     /* create requires to this package */
+
+    rpmRC rc = RPMRC_OK;
+    char *nvr;
+    const char *a;
+    int header_color;
+    int arch_color;
+
+    if (pkg == maindbg) {
+        /* if there is just one debuginfo package, we put our extra stuff
+         * in it. Otherwise we put it in the main debug package */
+        Package extradbg = !maindbg->fileList && maindbg->next && !maindbg->next->next ?
+         maindbg->next : maindbg;
+        if (addDebugDwz(extradbg, buildroot))
+        deplink = extradbg;
+        if (addDebugSrc(extradbg, buildroot))
+        deplink = extradbg;
+        if (dbgsrcpkg != NULL)
+        addPackageDeps(extradbg, dbgsrcpkg, RPMTAG_RECOMMENDNAME);
+        maindbg = NULL; /* all normal packages processed */
+    }
+
+    if (pkg->fileList == NULL)
+        goto exit;
+
+    headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName);
+
+    nvr = headerGetAsString(pkg->header, RPMTAG_NVRA);
+    rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr);
+    free(nvr);
+
+    if ((rc = processPackageFiles(spec, pkgFlags, pkg, didInstall, test)) != RPMRC_OK)
+        goto exit;
+
+    if (maindbg)
+        filterDebuginfoPackage(spec, pkg, maindbg, dbgsrcpkg,
+                   buildroot, uniquearch);
+    else if (deplink && pkg != deplink)
+        addPackageDeps(pkg, deplink, RPMTAG_REQUIRENAME);
+
+        if ((rc = rpmfcGenerateDepends(spec, pkg)) != RPMRC_OK)
+        goto exit;
+
+    a = headerGetString(pkg->header, RPMTAG_ARCH);
+    header_color = headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR);
+    if (!rstreq(a, "noarch")) {
+        arch_color = rpmGetArchColor(a);
+        if (arch_color > 0 && header_color > 0 &&
+                    !(arch_color & header_color)) {
+        rpmlog(RPMLOG_WARNING,
+               _("Binaries arch (%d) not matching the package arch (%d).\n"),
+               header_color, arch_color);
+        }
+    } else if (header_color != 0) {
+        int terminate = rpmExpandNumeric("%{?_binaries_in_noarch_packages_terminate_build}");
+        rpmlog(terminate ? RPMLOG_ERR : RPMLOG_WARNING, 
+           _("Arch dependent binaries in noarch package\n"));
+        if (terminate) {
+        rc = RPMRC_FAIL;
+        goto exit;
+        }
+    }
+exit:
+    return rc;
+}
+
 rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
 			int didInstall, int test)
 {
@@ -3031,7 +3101,6 @@ rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
     char *buildroot;
     char *uniquearch = NULL;
     Package maindbg = NULL;		/* the (existing) main debuginfo package */
-    Package deplink = NULL;		/* create requires to this package */
     /* The debugsource package, if it exists, that the debuginfo package(s)
        should Recommend.  */
     Package dbgsrcpkg = findDebugsourcePackage(spec);
@@ -3074,65 +3143,8 @@ rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
     }
 
     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
-	char *nvr;
-	const char *a;
-	int header_color;
-	int arch_color;
-
-	if (pkg == maindbg) {
-	    /* if there is just one debuginfo package, we put our extra stuff
-	     * in it. Otherwise we put it in the main debug package */
-	    Package extradbg = !maindbg->fileList && maindbg->next && !maindbg->next->next ?
-		 maindbg->next : maindbg;
-	    if (addDebugDwz(extradbg, buildroot))
-		deplink = extradbg;
-	    if (addDebugSrc(extradbg, buildroot))
-		deplink = extradbg;
-	    if (dbgsrcpkg != NULL)
-		addPackageDeps(extradbg, dbgsrcpkg, RPMTAG_RECOMMENDNAME);
-	    maindbg = NULL;	/* all normal packages processed */
-	}
-
-	if (pkg->fileList == NULL)
-	    continue;
-
-	headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName);
-
-	nvr = headerGetAsString(pkg->header, RPMTAG_NVRA);
-	rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr);
-	free(nvr);
-
-	if ((rc = processPackageFiles(spec, pkgFlags, pkg, didInstall, test)) != RPMRC_OK)
-	    goto exit;
-
-	if (maindbg)
-	    filterDebuginfoPackage(spec, pkg, maindbg, dbgsrcpkg,
-				   buildroot, uniquearch);
-	else if (deplink && pkg != deplink)
-	    addPackageDeps(pkg, deplink, RPMTAG_REQUIRENAME);
-
-        if ((rc = rpmfcGenerateDepends(spec, pkg)) != RPMRC_OK)
-	    goto exit;
-
-	a = headerGetString(pkg->header, RPMTAG_ARCH);
-	header_color = headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR);
-	if (!rstreq(a, "noarch")) {
-	    arch_color = rpmGetArchColor(a);
-	    if (arch_color > 0 && header_color > 0 &&
-					!(arch_color & header_color)) {
-		rpmlog(RPMLOG_WARNING,
-		       _("Binaries arch (%d) not matching the package arch (%d).\n"),
-		       header_color, arch_color);
-	    }
-	} else if (header_color != 0) {
-	    int terminate = rpmExpandNumeric("%{?_binaries_in_noarch_packages_terminate_build}");
-	    rpmlog(terminate ? RPMLOG_ERR : RPMLOG_WARNING, 
-		   _("Arch dependent binaries in noarch package\n"));
-	    if (terminate) {
-		rc = RPMRC_FAIL;
-		goto exit;
-	    }
-	}
+       if ((rc = processBinary(spec, pkg, pkgFlags, didInstall, test, maindbg, buildroot, dbgsrcpkg, uniquearch)) != RPMRC_OK)
+       goto exit;
     }
 
     /* Now we have in fileList list of files from all packages.