Differences between Fakeroot and Mock & Suggested method

Adam Williamson awilliam at redhat.com
Thu Oct 24 23:07:15 UTC 2013


On Thu, 2013-10-10 at 16:31 +0100, Richard W.M. Jones wrote:

> You don't really need to use mock either.  Just use 'rpmbuild -ba'
> directly or 'fedpkg local' which is a wrapper.

You don't need to, but there are a few reasons it's superior:

1) Your local environment is almost certainly dirty in multiple ways.
You likely have far more -devel packages installed than would be
installed for a 'clean' build of the package. This can, for instance,
hide the fact that you're missing BuildRequires in your spec, if you
happen to have the missing BRs installed. You may also have non-stock
versions of some packages installed that you've forgotten about,
packages from third-party repos etc, all of which may result in builds
working differently than they would in a 'proper' build.

2) Having a whole RPM build environment and all the -devels you'll build
up over a few months/years of package builds installed sure wastes your
disk space and makes your 'yum updates' needlessly intensive on time,
space and bandwidth.

I stopped doing local package builds entirely years ago; these days I
rarely even bother using mock, as that still results in considerable use
of local bandwidth and storage (though less than maintaining a dirty,
persistent local build environment). I just do koji scratch builds in
most cases. The koji builders are usually faster than your system
anyway, so you often get your builds back faster than you would doing
them locally, and it's very very easy to fire a scratch build. Just
generate the SRPM and do 'koji build --scratch fXX blah.src.rpm' , where
XX is the Fedora you want to build for (or use 'rawhide' for a Rawhide
build, IIRC).

There's only a few times a scratch build isn't practical: if you're
doing a set of chained builds, you can't use scratch builds, as you
can't have one scratch build build against another scratch build. In
this case I use mock: copy the mock .cfg file for the release you want
to build against to create a variant mock definition, add in a
repository definition for a side repo containing the package(s) you need
to build against to the variant .cfg, and run mock against that .cfg.
Also, it's against policy to build anything 'forbidden' as a scratch
build (e.g. patent-encumbered / non-free stuff), though it's fine to
build something which isn't a part of Fedora but doesn't violate any
Fedora policies AIUI.

Using mock and scratch builds is really pretty easy and painless, and
will result in far less 'crap, it built for me, why isn't it building in
Koji?'-type situations.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net



More information about the devel mailing list