puppetlabs/packaging — pull request #105 by MosesMendoza (2013-02-25 05:53:32+00:00)
Title: Add support for randomized mock roots

This commit adds support for using randomized mock build roots instead of the
current static '/var/lib/mock' directory. This enables parallelized builds with
mock. An attempt was made to create this ability within the mock configuration
itself, but actually passing a buildroot into mock is made difficult because
the calling program and mock itself don't share an environment (from which to
set/obtain environment variables). Randomizing the buildroot within the mock
config itself is trivial, but programmatically passing its location back into
the calling program is also difficult. This commit circumvents the issue by
just creating a new mock configuration with the build root defined and setting
up a configuration directory around it. This would be much easier if mock
supported a 'basedir' command line parameter, but it does not currently. To
invoke the randomized mock root, pass "RANDOM_MOCKROOT=true" as an environment variable to the rake invokation. The one downside of this functionality is that
it's slow - it requires the mock root to be rebuild with every build.