Bug 18281

Summary: -bp not working with --root
Product: [Retired] Red Hat Linux Reporter: Need Real Name <phutchis>
Component: rpm-buildAssignee: Jeff Johnson <jbj>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 6.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: 2000-10-04 02:04:09 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 Need Real Name 2000-10-04 02:04:06 UTC
I am trying to install and build a source RPM in an alternate location by
specifying --root.
(In case it matters, the RPM is mailx -- I'm planning to add some new
functionality.
To start with, I just want to build it from source, without overlaying the
installed binary.)
This may be related to 11310 and/or 11510, or it may just be a matter of my
not understanding
how it is supposed to work.  If the latter, adding an example to the
manpage would be helpful.

$ rpm --root /var/tmp --initdb
[complained about a missing directory]
$ mkdir -p /var/tmp/var/lib/rpm
$ rpm --root /var/tmp --initdb
[appeared to work OK]
$ rpm --root /var/tmp -i --percent /cdrom/SRPMS/mailx-8.1.1-10.src.rpm
[complained about another missing directory]
$ mkdir -p /var/tmp/usr/src/redhat/SOURCES
$ rpm --root /var/tmp -i --percent /cdrom/SRPMS/mailx-8.1.1-10.src.rpm
[appeared to work OK]
$ cd /var/tmp
$ rpm --root /var/tmp -bp mailx
File is not a regular file: /var/tmp/mailx
$ rpm --root /var/tmp -bp /usr/src/redhat/SPECS/mailx.spec
File is not a regular file: /usr/src/redhat/SPECS/mailx.spec
$ rpm --root /var/tmp -bp /var/tmp/usr/src/redhat/SPECS/mailx.spec
File /usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz: No such file or directory
$ cd /
$ rpm --root /var/tmp -bp /var/tmp/usr/src/redhat/SPECS/mailx.spec
File /usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz: No such file or directory
$ ls -l /usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz
ls: /usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz: No such file or directory
$ ls -l /var/tmp/usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz
-rw-r--r--    1 phutchis phutchis    89546 Mar 21  1999
/var/tmp/usr/src/redhat/SOURCES/mailx-8.1.1.tar.gz

As expected, specifying --root on the install caused the SRPM to be
installed under /var/tmp, but apparently neither the --root specification
nor the location of the current directory affects where the build will look
for the tarball -- it only looks in /usr/src/redhat/SOURCES.  This seems to
defeat the whole purpose of --root.  Am I doing something wrong?

Comment 1 Jeff Johnson 2000-10-04 14:59:53 UTC
--root  while building does not have the semantics you want to "... build a
source RPM in
an alternate location".

What you want to do is configure rpm to build in an alternate directory. For
example,
doing
	echo "%_topdir /your/directory/here" >> ~/.rpmmacros
will change the default /usr/src/redhat  hierarchy  used to build to
/your/directory/here.


Comment 2 Need Real Name 2000-10-04 22:31:54 UTC
With that change, it now builds and runs successfully although the resulting
executable is about 2KB larger than the original binary.  Maybe there's a
difference in patch level.

$ pwd
/var/tmp

$ ls -l usr/src/redhat/BUILD/mailx-8.1.1/mail mailx-root/bin/mail /bin/mail
-rwxr-xr-x    1 root     mail        62640 Aug  7 09:03 /bin/mail
-rwxr-xr-x    1 phutchis phutchis    64828 Oct  4 15:04 mailx-root/bin/mail
-rwxr-xr-x    1 phutchis phutchis    85778 Oct  4 14:58
usr/src/redhat/BUILD/mailx-8.1.1/mail

Might I suggest enhancing the manpage to include this sort of info (or a pointer
to more extensive documentation if any exists -- "info rpm" finds only the
manpage)?