Bug 97416 - Ability to overrule "hostname" as "Buildhost"
Summary: Ability to overrule "hostname" as "Buildhost"
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 9
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-15 02:13 UTC by Paul Bolle
Modified: 2007-03-27 04:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-04-07 17:07:40 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.