[arch-projects] [DEVTOOLS][PATCH 1/6] makechrootpkg: -I to handle multiple packages
Since commit cb3a6ce, running makechroot 2 times to insert a package in a build
directory require to find a directory without PKGBUILD
cd /var/empty
makechrootpkg -cu -I virtualbox-host-dkms-*-i686.pkg.tar.xz -r <dir>
makechrootpkg -I virtualbox-host-dkms-*-i686.pkg.tar.xz -r <dir>
cd -
makechrootpkg -n -r <dir>
This patch allow makechrootpkg to handle more than one package to be installed
before the build is run and simplify the previous case in
makechrootpkg -ncu -I virtualbox-host-dkms-*-i686.pkg.tar.xz -I virtualbox-guest-dkms-*-i686.pkg.tar.xz -r <dir>
Signed-off-by: Sébastien Luttringer
Signed-off-by: Sébastien Luttringer
Enable btrfs features only if the underlying filesystem is btrfs and not rely
on the presence of the btrfs tools.
Signed-off-by: Sébastien Luttringer
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
On Sat, Mar 2, 2013 at 5:21 AM, Sébastien Luttringer
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
--- 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
NACK. See comment to patch 6/6.
Signed-off-by: Sébastien Luttringer
Avoid to manually cleanup of subvolumes when a build was successful.
Really useful with random copy directory.
Signed-off-by: Sébastien Luttringer
On Sat, Mar 2, 2013 at 5:21 AM, Sébastien Luttringer
Avoid to manually cleanup of subvolumes when a build was successful. Really useful with random copy directory.
Signed-off-by: Sébastien Luttringer
--- makechrootpkg.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index 0e2d5c0..3f160bc 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -23,6 +23,7 @@ chrootdir= passeddir= declare -a install_pkgs declare -i ret=0 +no_purge=false
default_copy=$USER [[ -n $SUDO_USER ]] && default_copy=$SUDO_USER @@ -58,10 +59,11 @@ usage() { echo ' Useful for maintaining multiple copies.' echo " Default: $default_copy or random for btrfs" echo '-n Run namcap on the package' + echo "-p Don't purge the chroot copy after succesful build (btrfs only)" exit 1 }
-while getopts 'hcudr:I:l:n' arg; do +while getopts 'hcudr:I:l:np' arg; do case "$arg" in h) usage ;; c) clean_first=true ;; @@ -71,6 +73,7 @@ while getopts 'hcudr:I:l:n' arg; do I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; n) run_namcap=true; makepkg_args="$makepkg_args -i" ;; + p) no_purge=true ;; *) makepkg_args="$makepkg_args -$arg $OPTARG" ;; esac done @@ -321,4 +324,8 @@ done
if (( ret != 0 )); then die "Build failed, check $copydir/build" +elif [[ "$chroottype" == btrfs ]] && ! $no_purge; then + btrfs subvolume delete "$copydir" >/dev/null || + error "Unable to delete subvolume $copydir" + rm "$copydir.lock" fi -- Sébastien "Seblu" Luttringer
NACK. I disagree with making this the default. Copydirs named just with numbers are unhelpful on multiuser build servers. Chroots for failed builds are not removed, leading to clutter when builds fail. Copies aren't cheap enough to just leave them around, especially when additional dependencies are installed. Maybe this could be done if we had some kind of old copy garbage collection. Failing that, I'd rather have a single option (e.g. named -T for "temporary") combining both a random copydir, named using: [[ -z $copy ]] && copy=$default_copy copydir="$(mktemp -u "$chrootdir/$copy-XXXXXX")" and unconditionally removing the copydir after the build, whether it failed or not. The default behavior of makechrootpkg (without the option) remains.
Am 02.03.2013 07:32, schrieb Jan Steffens:
I disagree with making this the default. Copydirs named just with numbers are unhelpful on multiuser build servers. Chroots for failed builds are not removed, leading to clutter when builds fail. Copies aren't cheap enough to just leave them around, especially when additional dependencies are installed. Maybe this could be done if we had some kind of old copy garbage collection.
Failing that, I'd rather have a single option (e.g. named -T for "temporary") combining both a random copydir, named using: [[ -z $copy ]] && copy=$default_copy copydir="$(mktemp -u "$chrootdir/$copy-XXXXXX")" and unconditionally removing the copydir after the build, whether it failed or not. The default behavior of makechrootpkg (without the option) remains.
I would agree on that. -- Pierre Schmitz, https://pierre-schmitz.com
participants (3)
-
Jan Steffens
-
Pierre Schmitz
-
Sébastien Luttringer