648606
From 4a3d73081cb7db6673fa6775fbf5f6655f846241 Mon Sep 17 00:00:00 2001
648606
From: Florian Festi <ffesti@redhat.com>
648606
Date: Mon, 4 Jul 2016 18:34:44 +0200
648606
Subject: [PATCH] Fix rpmbuild --sign --quiet which relies on the output of
648606
 rpmbuild
648606
648606
by reproducing the output of the librpmbuild in the rpmbuild tool.
648606
---
648606
 rpmbuild.c | 31 +++++++++++++++++++++++++++++++
648606
 1 file changed, 31 insertions(+)
648606
648606
diff --git a/rpmbuild.c b/rpmbuild.c
648606
index 02d2655..aa63f97 100644
648606
--- a/rpmbuild.c
648606
+++ b/rpmbuild.c
648606
@@ -12,6 +12,7 @@
648606
 #include <rpm/rpmdb.h>
648606
 #include <rpm/rpmps.h>
648606
 #include <rpm/rpmts.h>
648606
+#include "build/rpmbuild_internal.h"
648606
 #include "lib/signature.h"
648606
 #include "cliutils.h"
648606
 
648606
@@ -517,6 +518,36 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
648606
     if (rpmSpecBuild(spec, ba)) {
648606
 	goto exit;
648606
     }
648606
+    /* Output generated package files for the --sign alias */
648606
+    if (quiet && rpmcliPipeOutput &&
648606
+	strncmp(rpmcliPipeOutput, "rpm --addsign", 13)) {
648606
+	rpmSetVerbosity(RPMLOG_INFO);
648606
+	if (buildAmount&RPMBUILD_PACKAGESOURCE) {
648606
+	    char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
648606
+	    rpmlog(RPMLOG_INFO, _("Wrote: %s\n"), fn);
648606
+	    fn = _free(fn);
648606
+	}
648606
+	if (buildAmount&RPMBUILD_PACKAGEBINARY) {
648606
+	    rpmSpecPkgIter pkgiter = rpmSpecPkgIterInit(spec);
648606
+	    for (rpmSpecPkg pkg = rpmSpecPkgIterNext(pkgiter);
648606
+		 pkg;
648606
+		 pkg = rpmSpecPkgIterNext(pkgiter)) {
648606
+		char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
648606
+		char *binRpm, *fn;
648606
+		const char *errorString;
648606
+		Header h = rpmSpecPkgHeader(pkg);
648606
+		if (h) {
648606
+		    binRpm = headerFormat(h, binFormat, &errorString);
648606
+		    fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
648606
+		    free(binRpm);
648606
+		    rpmlog(RPMLOG_INFO, _("Wrote: %s\n"), fn);
648606
+		    free(fn);
648606
+		}
648606
+		free(binFormat);
648606
+	    }
648606
+	}
648606
+	rpmSetVerbosity(RPMLOG_WARNING);
648606
+    }
648606
     
648606
     if (buildMode == 't')
648606
 	(void) unlink(specFile);
648606
-- 
648606
2.5.5
648606