[buildd-tools-devel] Bug#837795: setup.d/05file: cleanup, simplify, allow more compressors, enable parallel compression
Michael Tokarev
mjt at tls.msk.ru
Wed Sep 14 16:40:00 UTC 2016
Package: schroot
Version: 1.6.10-1+b1
Severity: wishlist
Tags: patch
Dear Maintainer,
Below is a patch for setup.d/05files which simplifies it
greatly, allows more archive compressions, and enables
parallel compressors for gzip and xz when pigz and pixz
utilities are installed.
Please consider using it in the future.
Thanks,
/mjt
-- System Information:
Debian Release: 8.5
APT prefers stable
APT policy: (990, 'stable'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.1-amd64 (SMP w/8 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages schroot depends on:
ii libboost-filesystem1.55.0 1.55.0+dfsg-3
ii libboost-iostreams1.55.0 1.55.0+dfsg-3
ii libboost-program-options1.55.0 1.55.0+dfsg-3
ii libboost-regex1.55.0 1.55.0+dfsg-3
ii libboost-system1.55.0 1.55.0+dfsg-3
ii libc6 2.19-18+deb8u4
ii libgcc1 1:4.9.2-10
ii libpam0g 1.1.8-3.1+deb8u1+b1
ii libstdc++6 4.9.2-10
ii libuuid1 2.25.2-6
ii schroot-common 1.6.10-1
schroot recommends no packages.
Versions of packages schroot suggests:
pn aufs-modules | unionfs-modules <none>
pn btrfs-tools <none>
pn debootstrap <none>
pn lvm2 <none>
pn qemu-user-static <none>
-- Configuration Files:
/etc/schroot/sbuild/fstab changed [not included]
/etc/schroot/setup.d/05file changed [not included]
-- no debconf information
--- /etc/schroot/setup.d/05file.dpkg-dist 2014-05-06 00:28:59.000000000 +0400
+++ /etc/schroot/setup.d/05file 2016-09-14 14:54:03.733647842 +0300
@@ -26,14 +26,16 @@
# Check file type
check_filetype()
{
- if echo "$CHROOT_FILE" | grep -q '\.tar$'; then
- filetype="tar"
- elif echo "$CHROOT_FILE" | egrep -q '(\.tar\.gz|\.tgz)$'; then
- filetype="tgz"
- elif echo "$CHROOT_FILE" | egrep -q '(\.tar\.bz2|\.tbz)$'; then
- filetype="tbz"
- else
- fatal "Unsupported filetype for $CHROOT_FILE"
+ case "$CHROOT_FILE" in
+ *.tar ) taropt=; tarpar= ;;
+ *.tar.gz | *.tgz ) taropt=-z; tarpar=pigz ;;
+ *.tar.bz2 | *.tbz2 | *.tbz ) taropt=-j; tarpar= ;;
+ *.tar.xz | *.txz ) taropt=-J; tarpar=pixz ;;
+ * ) fatal "Unsupported filetype for $CHROOT_FILE" ;;
+ esac
+ # enable parallel version of compressor if available
+ if [ -n "$tarpar" ] && type $tarpar >/dev/null; then
+ taropt="--use-compress=$tarpar"
fi
}
@@ -44,15 +46,7 @@
fatal "File '$CHROOT_FILE' does not exist"
fi
- if [ "$filetype" = "tar" ]; then
- tar $TAR_VERBOSE -xf "$CHROOT_FILE"
- elif [ "$filetype" = "tgz" ]; then
- tar $TAR_VERBOSE -xzf "$CHROOT_FILE"
- elif [ "$filetype" = "tbz" ]; then
- tar $TAR_VERBOSE -xjf "$CHROOT_FILE"
- else
- fatal "Unsupported filetype for $CHROOT_FILE"
- fi
+ tar $TAR_VERBOSE -xf "$CHROOT_FILE"
}
# Repack archive
@@ -62,15 +56,7 @@
trap "if [ -f \"$NEWFILE\" ]; then rm -f \"$NEWFILE\"; fi" 0
- if [ "$filetype" = "tar" ]; then
- tar $TAR_VERBOSE -cf "$NEWFILE" .
- elif [ "$filetype" = "tgz" ]; then
- tar $TAR_VERBOSE -czf "$NEWFILE" .
- elif [ "$filetype" = "tbz" ]; then
- tar $TAR_VERBOSE -cjf "$NEWFILE" .
- else
- fatal "Unsupported filetype for $CHROOT_FILE"
- fi
+ tar $TAR_VERBOSE -c $taropt -f "$NEWFILE" .
if [ -f "$CHROOT_FILE" ]; then
info "Setting ownership and permissions from old archive"
More information about the Buildd-tools-devel
mailing list