Bug 97416

Summary: Ability to overrule "hostname" as "Buildhost"
Product: [Retired] Red Hat Linux Reporter: Paul Bolle <pebolle>
Component: rpm-buildAssignee: Jeff Johnson <jbj>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 9Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-07 17:07:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Bolle 2003-06-15 02:13:13 UTC
At present one can define (a.o.) 'Packager' and 'Vendor' when one builds an rpm but not the 
'Buildhost'. 'Buildhost' will equal the 'hostname'. There seem to be valid reasons for that, but I 
still thought a 'buildhost' macro would be nice. Therefore, too much work let to this (trivial?) 
patch (against build/names.c of rpm 4.2 as distributed with Red Hat Linux 9): 
 
--- build/names.c	2002-07-02 21:07:03.000000000 +0200 
+++ build/names.c	2003-06-15 01:39:57.000000000 +0200 
@@ -198,7 +198,17 @@ 
     static char hostname[1024]; 
     static int gotit = 0; 
     struct hostent *hbn; 
+    char *rpmbh; 
  
+    if (gotit) return hostname; 
+    rpmbh=rpmExpand("%{?buildhost}", NULL); 
+    if (*rpmbh!='\0' && strlen(rpmbh)<sizeof hostname) { 
+        gotit=1; 
+        strcpy (hostname, rpmbh); 
+        rpmMessage(RPMMESS_NORMAL, "Buildhost set to '%s' for this build\n", rpmbh); 
+    } 
+    _free(rpmbh); 
+     
     if (! gotit) { 
         (void) gethostname(hostname, sizeof(hostname)); 
 	/*@-unrecog -multithreaded @*/ 
 
Do as you please with this patch.