From ae2bf135f8df216a1344bec89f77a093c2c72543 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Jun 02 2016 14:02:52 +0000 Subject: - Add support for _buildhost macro (#1309367) --- diff --git a/rpm-4.13.0-_buildhost-macro.diff b/rpm-4.13.0-_buildhost-macro.diff new file mode 100644 index 0000000..adefeae --- /dev/null +++ b/rpm-4.13.0-_buildhost-macro.diff @@ -0,0 +1,52 @@ +From 22588250baa1bfa5c00f57d39329d0c144fc8112 Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Thu, 2 Jun 2016 15:54:01 +0200 +Subject: [PATCH] Add support for _buildhost macro for setting the build host + manually. + +This is useful for reproducible builds. See rhbz#1309367. +--- + build/pack.c | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/build/pack.c b/build/pack.c +index f9fb3a0..82c1262 100644 +--- a/build/pack.c ++++ b/build/pack.c +@@ -179,16 +179,25 @@ static const char * buildHost(void) + static char hostname[1024]; + static int oneshot = 0; + struct hostent *hbn; ++ char *bhMacro; + + if (! oneshot) { +- (void) gethostname(hostname, sizeof(hostname)); +- hbn = gethostbyname(hostname); +- if (hbn) +- strcpy(hostname, hbn->h_name); +- else +- rpmlog(RPMLOG_WARNING, +- _("Could not canonicalize hostname: %s\n"), hostname); +- oneshot = 1; ++ bhMacro = rpmExpand("%{?_buildhost}", NULL); ++ if (strcmp(bhMacro, "") != 0 && strlen(bhMacro) < 1024) { ++ strcpy(hostname, bhMacro); ++ } else { ++ if (strcmp(bhMacro, "") != 0) ++ rpmlog(RPMLOG_WARNING, _("The _buildhost macro is too long\n")); ++ (void) gethostname(hostname, sizeof(hostname)); ++ hbn = gethostbyname(hostname); ++ if (hbn) ++ strcpy(hostname, hbn->h_name); ++ else ++ rpmlog(RPMLOG_WARNING, ++ _("Could not canonicalize hostname: %s\n"), hostname); ++ } ++ free(bhMacro); ++ oneshot = 1; + } + return(hostname); + } +-- +2.5.5 + diff --git a/rpm.spec b/rpm.spec index 9f50476..041fe3b 100644 --- a/rpm.spec +++ b/rpm.spec @@ -29,7 +29,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}36%{?dist} +Release: %{?snapver:0.%{snapver}.}37%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2 @@ -84,6 +84,7 @@ Patch128: rpm-4.13.0-stringFormat-sigsegv.patch Patch129: rpm-4.13.0-filter-unversioned.patch Patch130: rpm-4.13.0-armv7hl-isa.patch Patch131: rpm-4.13.0-non-ASCII-keys.patch +Patch132: rpm-4.13.0-_buildhost-macro.diff # These are not yet upstream Patch302: rpm-4.7.1-geode-i686.patch @@ -595,6 +596,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Thu Jun 02 2016 Florian Festi - 4.4.13.0-0.rc1.37 +- Add support for _buildhost macro (#1309367) + * Mon May 23 2016 Lubos Kardos 4.13.0-0.rc1.36 - Fix signing with non-ASCII uid keys (#1243963)