[arch-projects] [DEVTOOLS][PATCH 4/6] makechrootpkg: Use random copy directory with btrfs
Sébastien Luttringer
seblu at seblu.net
Fri Mar 1 23:21:11 EST 2013
btrfs COW allow almost gratuitous create/destroy chroot copy.
To allow automatic parallel builds the default copy value is $RANDOM when the
underlying filesytem is btrfs.
Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
---
makechrootpkg.in | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index c8b5f87..7a780df 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -55,7 +55,7 @@ usage() {
echo '-I <pkg> Install a package into the working copy of the chroot'
echo '-l <copy> The directory to use as the working copy of the chroot'
echo ' Useful for maintaining multiple copies.'
- echo " Default: $default_copy"
+ echo " Default: $default_copy or random for btrfs"
echo '-n Run namcap on the package'
exit 1
}
@@ -80,12 +80,17 @@ chrootdir=$(readlink -e "$passeddir")
# Detect chrootdir filesystem type
chroottype=$(stat -f -c %T "$chrootdir")
+# Define copy directory
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
-else
- [[ -z $copy ]] && copy=$default_copy
+elif [[ -n $copy ]]; then
copydir="$chrootdir/$copy"
+elif [[ "$chroottype" == btrfs ]]; then
+ copydir="$chrootdir/$RANDOM"
+else
+ copydir="$chrootdir/$default_copy"
fi
+copy=${copydir##*/}
# Pass all arguments after -- right to makepkg
makepkg_args="$makepkg_args ${*:$OPTIND}"
--
Sébastien "Seblu" Luttringer
More information about the arch-projects
mailing list