Bug 1026

Summary: rpm: Setting buildroot via rpmrc and --buildroot does not work
Product: [Retired] Red Hat Linux Reporter: moh
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-12-16 19:29:28 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 moh 1999-02-02 15:54:12 UTC
Setting the buildroot path via command line option
  --buildroot or rpmrc file does not work as expected.

As far as I can see the entry in the rpmrc file is
completely ignored.

When using the --buildroot switch together with badly
formatted directory names (/x//y/z/) the first characters
from filenames found in the resulting rpm package are
removed. (usr/bin/xx instead of /usr/bin/xx) This
happens when directories are specified in the %files
section.

Fix:

--- rpm-2.5.5/build.c   Thu Sep 24 22:23:16 1998
+++ rpm-2.5.5_mod/build.c       Tue Feb  2 15:59:45 1999
@@ -18,6 +18,7 @@
 #include "build/build.h"
 #include "build/parse.h"
 #include "build/spec.h"
+#include "build/misc.h"

 int build(char *arg, int buildAmount, char *passPhrase,
                 char *buildRoot, int fromTarball, int test,
char *cookie) {
@@ -135,6 +136,11 @@
        }
        s++;
     }
+
+    if (!buildRoot)
+       buildRoot = rpmGetVar(RPMVAR_BUILDROOT);
+    if (buildRoot)
+       buildRoot = strdup(cleanFileName(buildRoot));

 #define        _anyarch(_f)    \
 (((_f)&(RPMBUILD_PACKAGESOURCE|RPMBUILD_PACKAGEBINARY)) ==
RPMBUILD_PACKAGESOURCE)

Comment 1 Jeff Johnson 1999-12-16 19:29:59 UTC
Fixed in rpm-3.0.4-0.16 (with apologies for the long delay).