CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Bug #581: Users may choose from gz/bz2/xz for the compression mode now.
authorJuergen Daubert <jue@jue.li>
Fri, 21 May 2010 18:03:48 +0000 (20:03 +0200)
committerTilman Sauerbeck <tilman@crux.nu>
Fri, 21 May 2010 18:03:48 +0000 (20:03 +0200)
pkgmk.conf
pkgmk.conf.5.in
pkgmk.in

index 07b1cbd53e310e55f008fac759d020e729bf2b56..0fc3176793a8d16b29f1e4046cfe38e65e99b812 100644 (file)
@@ -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
index dcb6a207124240f654fb4ac6ce3f5f626c1bb734..216a3e114ca0431e982693827ea05336d7f9b018 100644 (file)
@@ -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
index b8e3e4e1957086b9b255e31973dfdb64f8a5206d..2a6a27d1cbbaba9da59283605152533c6f23cc73 100755 (executable)
--- 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"