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?
--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.
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)?