alexk / rpms / rpm

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