From 37c478ef8b53608ffa9cfdedac2f65a2287ac5b9 Mon Sep 17 00:00:00 2001 From: Juergen Daubert Date: Fri, 21 May 2010 20:03:48 +0200 Subject: [PATCH] Bug #581: Users may choose from gz/bz2/xz for the compression mode now. --- pkgmk.conf | 1 + pkgmk.conf.5.in | 5 +++++ pkgmk.in | 27 ++++++++++++++++++++++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/pkgmk.conf b/pkgmk.conf index 07b1cbd..0fc3176 100644 --- a/pkgmk.conf +++ b/pkgmk.conf @@ -13,5 +13,6 @@ export CXXFLAGS="-O2 -march=i686 -pipe" # PKGMK_IGNORE_FOOTPRINT="no" # PKGMK_NO_STRIP="no" # PKGMK_WGET_OPTS="" +# PKGMK_COMPRESSION_MODE="gz" # End of file diff --git a/pkgmk.conf.5.in b/pkgmk.conf.5.in index dcb6a20..216a3e1 100644 --- a/pkgmk.conf.5.in +++ b/pkgmk.conf.5.in @@ -57,6 +57,11 @@ Default: 'no' If set to 'no', pkgmk will strip built binaries. .br Default: 'no' +.TP +\fBPKGMK_COMPRESSION_MODE='STRING'\fP +Option to select the mode used to compress the packages. Valid strings are gz, bz2 and xz. +.br +Default: 'gz' .SH SEE ALSO pkgmk(8) .SH COPYRIGHT diff --git a/pkgmk.in b/pkgmk.in index b8e3e4e..2a6a27d 100755 --- a/pkgmk.in +++ b/pkgmk.in @@ -353,6 +353,7 @@ remove_work_dir() { build_package() { local BUILD_SUCCESSFUL="no" + local COMPRESSION check_file "$TARGET" make_work_dir @@ -377,8 +378,14 @@ build_package() { cd $PKG info "Build result:" - tar czvvf $TARGET * - + + case $PKGMK_COMPRESSION_MODE in + gz) COMPRESSION="-z" ;; + bz2) COMPRESSION="-j" ;; + xz) COMPRESSION="-J" ;; + esac + bsdtar -c $COMPRESSION -f $TARGET * && bsdtar -t -v -f $TARGET + if [ $? = 0 ]; then BUILD_SUCCESSFUL="yes" @@ -606,9 +613,17 @@ main() { check_directory "`dirname $PKGMK_WORK_DIR`" check_pkgfile - - TARGET="$PKGMK_PACKAGE_DIR/$name#$version-$release.pkg.tar.gz" - + + case $PKGMK_COMPRESSION_MODE in + gz|bz2|xz) + TARGET="$PKGMK_PACKAGE_DIR/$name#$version-$release.pkg.tar.$PKGMK_COMPRESSION_MODE" + ;; + *) + error "Compression mode '$PKGMK_COMPRESSION_MODE' not supported" + exit 1 + ;; + esac + if [ "$PKGMK_CLEAN" = "yes" ]; then clean exit 0 @@ -682,6 +697,8 @@ PKGMK_SOURCE_DIR="$PWD" PKGMK_PACKAGE_DIR="$PWD" PKGMK_WORK_DIR="$PWD/work" +PKGMK_COMPRESSION_MODE="gz" + PKGMK_INSTALL="no" PKGMK_RECURSIVE="no" PKGMK_DOWNLOAD="no" -- 2.26.2