Hi,
Juergen came up with a patch that lets users choose what compression
scheme to use for packages created by pkgmk. Supported compression
algorithms are gzip, bzip2 and xz.

I now extended the patch with some text for the pkgmk.conf manpage and
renamed PKGMK_COMPRESS_EXT to PKGMK_COMPRESS_MODE (that feels like a
better fit to me).

To test this patch, you need pkgadd/pkginfo from pkgutils.git (master
branch). Otherwise you won't be able to generate footprints/add/etc
packages that use bzip2/xz.

Please review the patch and if possible, test this new feature. Let me
know what you think/find.

Thanks,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
diff --git a/pkgmk.conf b/pkgmk.conf
index 07b1cbd..965df5c 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_COMPRESS_MODE="gz"
 
 # End of file
diff --git a/pkgmk.conf.5.in b/pkgmk.conf.5.in
index dcb6a20..7787afe 100644
--- a/pkgmk.conf.5.in
+++ b/pkgmk.conf.5.in
@@ -57,6 +57,13 @@ Default: 'no'
 If set to 'no', pkgmk will strip built binaries.
 .br
 Default: 'no'
+.TP
+\fBPKGMK_COMPRESS_MODE='STRING'\fP
+Specifies how pkgmk will compress created packages.
+Supported values are 'gz' for gzip, 'bz2' for bzip2 and 'xz' for xz.
+.br
+Default: 'gz'
+
 .SH SEE ALSO
 pkgmk(8)
 .SH COPYRIGHT
diff --git a/pkgmk.in b/pkgmk.in
index b8e3e4e..ed92558 100755
--- a/pkgmk.in
+++ b/pkgmk.in
@@ -353,6 +353,7 @@ remove_work_dir() {
 
 build_package() {
        local BUILD_SUCCESSFUL="no"
+       local COMPRESS_MODE
        
        check_file "$TARGET"
        make_work_dir
@@ -377,8 +378,15 @@ build_package() {
                
                cd $PKG
                info "Build result:"
-               tar czvvf $TARGET *
-               
+
+               case $PKGMK_COMPRESS_MODE in
+                       gz)  COMPRESS_MODE="-z" ;;
+                       bz2) COMPRESS_MODE="-j" ;;
+                       xz)  COMPRESS_MODE="-J" ;;
+               esac
+               bsdtar -c $COMPRESS_MODE -f $TARGET *
+               bsdtar -t -v -f $TARGET
+
                if [ $? = 0 ]; then
                        BUILD_SUCCESSFUL="yes"
 
@@ -606,9 +614,17 @@ main() {
        check_directory "`dirname $PKGMK_WORK_DIR`"
        
        check_pkgfile
-       
-       TARGET="$PKGMK_PACKAGE_DIR/$name#$version-$release.pkg.tar.gz"
-       
+
+       case $PKGMK_COMPRESS_MODE in
+               gz|bz2|xz)
+                       
TARGET="$PKGMK_PACKAGE_DIR/$name#$version-$release.pkg.tar.$PKGMK_COMPRESS_MODE"
+                       ;;
+               *)
+                       error "Compress type '$PKGMK_COMPRESS_MODE' not 
supported"
+                       exit 1
+                       ;;
+       esac
+
        if [ "$PKGMK_CLEAN" = "yes" ]; then
                clean
                exit 0
@@ -682,6 +698,8 @@ PKGMK_SOURCE_DIR="$PWD"
 PKGMK_PACKAGE_DIR="$PWD"
 PKGMK_WORK_DIR="$PWD/work"
 
+PKGMK_COMPRESS_MODE="gz"
+
 PKGMK_INSTALL="no"
 PKGMK_RECURSIVE="no"
 PKGMK_DOWNLOAD="no"

Attachment: pgpgMCwaWsIZj.pgp
Description: PGP signature

_______________________________________________
crux-devel mailing list
crux-devel@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux-devel

Reply via email to