diff -Nurp pacman-4.0.1~/etc/makepkg.conf pacman-4.0.1/etc/makepkg.conf --- pacman-4.0.1~/etc/makepkg.conf 2011-11-21 04:30:34.000000000 +0100 +++ pacman-4.0.1/etc/makepkg.conf 2011-12-04 00:05:37.076835259 +0100 @@ -116,4 +116,21 @@ PURGE_TARGETS=(usr/{,share}/info/dir .pa PKGEXT='.pkg.tar.gz' SRCEXT='.src.tar.gz' +######################################################################### +# COMPRESSION DEFAULTS +######################################################################### +# +# +# Format: 'file extension::program and parameters' +# +COMPRESSORS=('.pkg.tar.gz::gzip -c -f -n' + '.pkg.tar.bz2::bzip2 -c -f' + '.pkg.tar.xz::xz -c -z -' + '.pkg.tar.Z::compress -c -f' + '.pkg.tar::cat') + +# Other common tools: +# pigz -c -f -n +# pbzip2 -c -f + # vim: set ft=sh ts=2 sw=2 et: diff -Nurp pacman-4.0.1~/etc/makepkg.conf.in pacman-4.0.1/etc/makepkg.conf.in --- pacman-4.0.1~/etc/makepkg.conf.in 2011-11-15 16:37:42.000000000 +0100 +++ pacman-4.0.1/etc/makepkg.conf.in 2011-12-04 00:05:56.873023962 +0100 @@ -116,4 +116,21 @@ PURGE_TARGETS=(usr/{,share}/info/dir .pa PKGEXT='@PKGEXT@' SRCEXT='@SRCEXT@' +######################################################################### +# COMPRESSION DEFAULTS +######################################################################### +# +# +# Format: 'file extension::program and parameters' +# +COMPRESSORS=('.pkg.tar.gz::gzip -c -f -n' + '.pkg.tar.bz2::bzip2 -c -f' + '.pkg.tar.xz::xz -c -z -' + '.pkg.tar.Z::compress -c -f' + '.pkg.tar::cat') + +# Other common tools: +# pigz -c -f -n +# pbzip2 -c -f + # vim: set ft=sh ts=2 sw=2 et: diff -Nurp pacman-4.0.1~/scripts/makepkg.sh.in pacman-4.0.1/scripts/makepkg.sh.in --- pacman-4.0.1~/scripts/makepkg.sh.in 2011-11-21 04:17:43.000000000 +0100 +++ pacman-4.0.1/scripts/makepkg.sh.in 2011-12-04 00:15:51.968655178 +0100 @@ -1262,16 +1262,24 @@ create_package() { # bsdtar's gzip compression always saves the time stamp, making one # archive created using the same command line distinct from another. # Disable bsdtar compression and use gzip -n for now. - bsdtar -cf - $comp_files * | - case "$PKGEXT" in - *tar.gz) gzip -c -f -n ;; - *tar.bz2) bzip2 -c -f ;; - *tar.xz) xz -c -z - ;; - *tar.Z) compress -c -f ;; - *tar) cat ;; - *) warning "$(gettext "'%s' is not a valid archive extension.")" \ - "$PKGEXT"; cat ;; - esac > "${pkg_file}" || ret=$? + + # loop through COMPRESSORS variable looking for file extentsion + local i + for i in "${COMPRESSORS[@]}"; do + local extension="${i%%::*}" + if [[ ${PKGEXT} = ${extension} ]]; then + local compress="${i##*::}" + break + fi + done + + # if we didn't find an program default to cat and to not compress + if [[ -z ${compress} ]]; then + warning "$(gettext "File extension is onknown, package will not be compressed.")" + compress="cat" + fi + + bsdtar -cf - ${comp_files} * | ${compress} > "${pkg_file}" || ret=$? shopt -u nullglob shopt -u -o pipefail