[arch-projects] [DEVTOOLS][PATCH 2/3] makechrootpkg: Add option to build in temp chroot

Sébastien Luttringer seblu at seblu.net
Sat Apr 6 21:14:59 EDT 2013


On Sat, Mar 16, 2013 at 9:45 AM, Pierre Schmitz <pierre at archlinux.de> wrote:
> Am 14.03.2013 03:55, schrieb Sébastien Luttringer:
>> Add option -T to build in a temporary chroot. This apply to any kind of
>> filesytem and allow to easily parrallelize builds.
>>
>> This patch also simplify how $default_copy and $copy are defined.
>>
>> Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
>> ---
>>  makechrootpkg.in | 33 +++++++++++++++++++++++++--------
>>  1 file changed, 25 insertions(+), 8 deletions(-)
>>
>>
>> +             T) temp_chroot=true; copy+="-$RANDOM" ;;
>
> Maybe use mktemp -d here. Otherwise it's possible to get random number
> twice.

As Jan suggested, we can use mktemp with -u get the directory name.
It's unsafe too, so it's basically the same as using $RANDOM except
the fork.
The probability of getting the same number twice is so small and even
not an issue (as we still have the lock mechanism).
The penalty if a user generate twice the same number, is to wait the
first build end before the second start.

Cheers,
--
Sébastien "Seblu" Luttringer
https://www.seblu.net
GPG: 0x2072D77A


More information about the arch-projects mailing list