public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: - Add support for _buildhost macro (#1309367)
@ 2026-11-23  9:30 Florian Festi
  0 siblings, 0 replies; only message in thread
From: Florian Festi @ 2026-11-23  9:30 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rpm
Branch : pmatilai-v6
Commit : ae2bf135f8df216a1344bec89f77a093c2c72543
Author : Florian Festi <ffesti@redhat.com>
Date   : 2016-06-02T16:02:52+02:00
Stats  : +57/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rpm/c/ae2bf135f8df216a1344bec89f77a093c2c72543?branch=pmatilai-v6

Log:
- 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 <ffesti@redhat.com>
+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 <ffesti@rpm.org> - 4.4.13.0-0.rc1.37
+- Add support for _buildhost macro (#1309367)
+
 * Mon May 23 2016 Lubos Kardos <lkardos@redhat.com> 4.13.0-0.rc1.36
 - Fix signing with non-ASCII uid keys (#1243963)
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:30 [rpms/rpm] pmatilai-v6: - Add support for _buildhost macro (#1309367) Florian Festi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox