RPM Community Forums

Mailing List Message of <rpm-users>

Re: Question about "rpmbuild --root"

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 14 Feb 2011 - 15:54:30 CET
Message-id: <9300F617-5A5D-4338-8755-511E8D03D4FE@mac.com>

On Feb 14, 2011, at 9:39 AM, Eric MSP Veith wrote:

> Am Montag, 14. Februar 2011, 14:41:42 schrieb Jeff Johnson:
>>> The latter one I solved by calling "sudo rpmbuild".
>> 
>> So no figger where rpmbuild is supposed to read its configuration from.
>> That's a bit harder than using sudo to get uid == 0.
> 
> I don't understand. :-/ There are hardcoded macro file paths like 
> /usr/lib/rpm/macros:~/.rpmmacros. "~" resolves to ~root or ~myuser based on 
> what variables sudo sets. I don't expect RPM to add some extra magic 
> dowhatIwant(). Or should I?
> 

The necessary PATH's change when chroot(2) is done. All depends on
what is being attempted. Macros are lazily evaluated and many
will be evaluated after rpmbuild starts while the *.spec file is being parsed.

The *.spec itself iscoming from the CLI before chroot(2) is
called, but will be parsed after chroot(2) is called.

>> Depends on context.
>> 
>> Traditionally, RPM implicitly added --root to --dbpath when opening
>> an rpmdb and expected the user to "know" when to add the chroot
>> prefix to the --dbpath argument for non-root execution.
>> 
>> But PLD wanted --rebuilddb --root instead of --rebuildb --dbpath
>> (where one had to manually insert the root prefix in the --dbpath
>> argument).
>> 
>> So --root and --dbpath behavior was changed.
> 
> I don't quite get the implications. But I guess that when I encounter a 
> problem related to this, I'll remember this part and hopefully be able to use 
> this particular information. :-)
> 

SHort answer: --root doesn't behave (in all contexts) correctly with --dbpath
and other configuration. And --root was originally specific to chroot(2)
while --dbpath was a path to an rpmdb. These are semantically different data
values that are now all mixed together.

>>> Ok, off trying... :-)
>> 
>> Good luck!
> 
> TA! I hoped that I could do the config file reading and loading .so files into 
> memory and do the chroot() just before doing the actual call to build(). So 
> everything should already reside in memory and the only thing that needs to be 
> in the chroot is the rpmdb. Well, I'll see.
> 

Add --nodeps to rpmbuild args and don't bother with build dependencies.
Chasing an rpmdb into a chroot(2) (or maintaining 2 copies in sync) is better avoided
initially imho.

>> FYI: --root takes a /string which is used to construct a command that looks
>> like rsh -c "chroot /string ..."
>> that isn't what anyone is expecting but is exactly what was intended.
> 
> You mean via %_remchroot, %_remroot & Co? These are never filled here. I 
> already tried to manually add -D '%_remroot /my/chroot' and so on, but that 
> didn't work, too. What am I missing?
> 

Yes those macros.

Not missing anything. Noone has tried/used those macros since forever.
I likely last looked ~2002, but got tired of the endless "Have it your own way!"
discussions.

If I get anywhere with pogoplugs and qemu for ARM builds, I may resurrect,
or (equivalently) link to a libssh.

73 de Jeff



  • application/pkcs7-signature attachment: smime.p7s
Received on Mon Feb 14 15:54:36 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.