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 - 13:26:32 CET
Message-id: <1E27F9A0-6FFF-41F5-953B-44463BED4126@mac.com>

On Feb 14, 2011, at 3:43 AM, Eric MSP Veith wrote:

> Am Sonntag, 13. Februar 2011, 21:07:45 schrieb Jeff Johnson:
>> Depends. --root (as wired in rpmbuild) isn't doing what you think
>> its doing. What rpmbuild --root is actually attempting is considerably
>> harder to explain, dates back to 2000 or so ...
> Hm, well, the manpage says it'll chroot() before running any scriptlets. But 
> skimming through the sources, I found no call to chroot(2). Hum. Manpage 
> "bug"?

Yes but ... rpmbuild --root is not doing chroot(2), never has done chroot(2),
and cannot do chroot(2) unless uid == 0.

It in the man page because someone insisted:
	Its a CLI option so it MUST be in the man page.
and it was easier to oblige than explain.

>> 	chroot /wherever rpmbuild ...
>> if you want/need single invocation functionality. But you
>> likely just want to enter the chroot, and use rpmbuild inside.
>> 	chroot /wherever
>> 	rpmbuild ...
> Which, however, will force me to install RPM with all deps inside the chroot, 
> right? 

Essentially yes.

> And without having tried it I guess that doing it programatically I could call 
> chroot() before buildSpec() and it *should* work? If so, I'm back working on 
> my small little build system... :-)

File path's get implicitly prefixed when chroot(2) is called.

There's harder issues, like readong configuration (from inside or outside the chroot?)
and finding the rpmdb (inside or outside?) and writing *.rpm output (inside or outside),
but otherwise yes.

73 de Jeff

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