Strange mock behaviour - buildrequires in the host?

Paul Howarth paul at city-fan.org
Thu Jul 24 09:19:11 UTC 2008


Martin Langhoff wrote:
> Hi,
> 
> while building some packages for the OLPC XS I am seeing some odd
> behaviour from Mock. I am not certain whether this is expected...
> 
> 1 - The F9 host had httpd installed (unbeknownst to me)
> 2 - The install script in the package was (wrongly) trying to do
> install -o apache /file - which errored out "no such user"
> 3 - Adding a BuildRequires to the spec file fixed the problem - mock
> installed httpd in the chroot - however, install would still fail as
> it was not running as root.
> 4 - I spotted httpd on the host and removed it. I can no longer build
> the package - "httpd is needed by ds-backup-x-y-z..."
> 
> There are 2 weird things in here for me:
> 
> - In step 4 - the host environment not having httpd should not affect
> the build chroot.
> 
> - In step 3, I was expecting the rpmbuild running the "install" target
> inside mock to be using fakeroot or something similar.

The fix for this is to remove (patch out) the "-o httpd" option from the 
install section of the Makefile (the chown won't work as a non-root 
user, and RPMs should always be built as non-root users), and instead 
use %attr in the spec file's %files section to indicate that the 
installed file should be owned by the "httpd" user. Check out the specs 
for most web apps in Fedora for examples.

This method will mean that you don't need to buildrequire httpd too 
(though you will still need to require it as a runtime dependency so 
ensure that the httpd account exists on the target system).

Paul.




More information about the fedora-devel-list mailing list