[csw-devel] [PATCH] mGAR v2: Add an option to run pigz

Maciej Blizinski maciej at opencsw.org
Mon Aug 15 08:16:01 CEST 2011


---
 gar/v2/bin/mkpackage |   12 +++++++++---
 gar/v2/gar.conf.mk   |    3 +++
 gar/v2/gar.pkg.mk    |    1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gar/v2/bin/mkpackage b/gar/v2/bin/mkpackage
index 8e10918..b077b4f 100755
--- a/gar/v2/bin/mkpackage
+++ b/gar/v2/bin/mkpackage
@@ -318,6 +318,7 @@ sub process_arguments {
         'overwrite!'   => \$config{overwrite},
         'compress!'    => \$config{compress},
         'usebzip'      => \$config{usebzip},
+        'usepigz'      => \$config{usepigz},
         'quiet|q'      => \$config{quiet},
         'help'         => \$args{help},
         'manual'       => \$args{man},
@@ -397,6 +398,7 @@ sub process_arguments {
     $config{transfer}  = 1 unless defined $config{transfer};
     $config{overwrite} = 0 unless defined $config{overwrite};
     $config{usebzip}   = 0 unless defined $config{usebzip};
+    $config{usepigz}   = 0 unless defined $config{usepigz};
 
     # Export variables to the spec
     $ENV{$_} = $config{$_} foreach qw/
@@ -911,7 +913,7 @@ sub transfer_package {
         my $compress =
           $config{usebzip}
           ? 'bzip2 -9 -f %s'
-          : 'gzip -9 -f %s';
+          : ($config{usepigz} ? 'pigz -9 -f %s' : 'gzip -9 -f %s');
 
         vexec( sprintf( $compress, $tmppkg ), "Failed to compress $tmppkg" );
         $tmppkg .= $config{usebzip} ? ".bz2" : ".gz";
@@ -953,8 +955,8 @@ mkpackage - Create one or more Solaris packages from a 'spec' file.
  mkpackage --spec <path> [--destdir <path>] [--workdir <path>]
         [--spooldir <path>] [--pkgroot <path>] [--tmpdir <path>]
         [--[no]transfer] [--[no]overwrite] [--[no]compress]
-        [--usebzip] [-v var=value...] [--dump <var>|-dumpall] [--quiet]
-        [--help] [--manual] [--version]
+        [--usebzip] [--usepigz] [-v var=value...] [--dump <var>|-dumpall]
+        [--quiet] [--help] [--manual] [--version]
 
 =head1 DESCRIPTION
 
@@ -1032,6 +1034,10 @@ Enable bzip2 compression.  Unless --nocompress and/or --notransfer options are
 specified, mkpackage will compress bitstream packages using gzip.  Specifying
 --usebzip will use bzip2 instead, producing smaller archives in most cases.
 
+=head2 --usepigz
+
+Use pigz, a parallel implementation of gzip.
+
 =head2 -v var=value
 
 Build time variables.  Specify one or more variable replacements for pkgmk
diff --git a/gar/v2/gar.conf.mk b/gar/v2/gar.conf.mk
index 82f31a5..d26b006 100644
--- a/gar/v2/gar.conf.mk
+++ b/gar/v2/gar.conf.mk
@@ -735,6 +735,9 @@ export PATH PKG_CONFIG_PATH
 # prepend the local file listing
 FILE_SITES = $(foreach DIR,$(FILEDIR) $(GARCHIVEPATH),file://$(DIR)/)
 
+# For example, --usepigz
+EXTRA_MKPACKAGE_OPTS ?=
+
 # Extra libraries
 EXTRA_LIBS = gar.pkg.mk gar.common.mk gar.svn.mk
 ccenv:
diff --git a/gar/v2/gar.pkg.mk b/gar/v2/gar.pkg.mk
index 6419b54..73020ba 100644
--- a/gar/v2/gar.pkg.mk
+++ b/gar/v2/gar.pkg.mk
@@ -941,6 +941,7 @@ package-%: $(WORKDIR)/%.gspec $(WORKDIR)/%.prototype-$(GARCH) $(WORKDIR)/%.depen
 						 --workdir  $(SPKG_WORKDIR) \
 						 --pkgbase  $(SPKG_PKGBASE) \
 						 --pkgroot  $(SPKG_PKGROOT) \
+						 $(EXTRA_MKPACKAGE_OPTS)  \
 						-v WORKDIR_FIRSTMOD=../build-$(firstword $(MODULATIONS)) \
 						 $(if $(_DIRPACKAGE),--notransfer --nocompress,--compress) \
 						 $(MKPACKAGE_ARGS) ) || exit 2
-- 
1.7.5.4



More information about the devel mailing list