config_host.mk.in                             |    1 +
 configure.ac                                  |   10 ++++++++++
 instsetoo_native/CustomTarget_install.mk      |    1 +
 solenv/bin/modules/installer/download.pm      |    2 +-
 solenv/bin/modules/installer/epmfile.pm       |    4 ++--
 solenv/bin/modules/installer/globals.pm       |    2 ++
 solenv/bin/modules/installer/helppack.pm      |    2 +-
 solenv/bin/modules/installer/languagepack.pm  |    2 +-
 solenv/bin/modules/installer/parameter.pm     |    2 ++
 solenv/bin/modules/installer/simplepackage.pm |    2 +-
 solenv/bin/modules/installer/worker.pm        |    2 +-
 11 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit b8278d93bbf8c63e283024783da32f84f7e4f246
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Sat Jan 15 16:24:33 2022 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Sat Jan 22 10:14:23 2022 +0100

    Make installer compression tool configurable
    
    So we can use pigz or other parallelizable tools if available. Shaves
    off noticeable build time when packaging install sets.
    
    - figure out if pigz is available (fallback to gzip otherwise)
    - pass compression tool down into make_installer
    - and handle as one of many global options there
    
    Change-Id: Ia9d1ea27a9f990874238b6f0be3e1fd30a662ec6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128469
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/config_host.mk.in b/config_host.mk.in
index 193406c8fbc9..f512e719ee6c 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -85,6 +85,7 @@ export COMPILER_PLUGINS_CXXFLAGS=@COMPILER_PLUGINS_CXXFLAGS@
 export COMPILER_PLUGINS_CXX_LINKFLAGS=@COMPILER_PLUGINS_CXX_LINKFLAGS@
 export COMPILER_PLUGINS_DEBUG=@COMPILER_PLUGINS_DEBUG@
 export COMPILER_PLUGINS_TOOLING_ARGS=@COMPILER_PLUGINS_TOOLING_ARGS@
+export COMPRESSIONTOOL=@COMPRESSIONTOOL@
 export COM_IS_CLANG=@COM_IS_CLANG@
 export CPPU_ENV=@CPPU_ENV@
 export CPPU_ENV_FOR_BUILD=@CPPU_ENV_FOR_BUILD@
diff --git a/configure.ac b/configure.ac
index 53b2323a2c09..d657aed4a01e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2916,6 +2916,16 @@ if test -z "$BASH"; then
 fi
 AC_SUBST(BASH)
 
+# prefer parallel comression tools, if available
+AC_PATH_PROG(COMPRESSIONTOOL, pigz)
+if test -z "$COMPRESSIONTOOL"; then
+    AC_PATH_PROG(COMPRESSIONTOOL, gzip)
+    if test -z "$COMPRESSIONTOOL"; then
+        AC_MSG_ERROR([gzip not found in \$PATH])
+    fi
+fi
+AC_SUBST(COMPRESSIONTOOL)
+
 AC_MSG_CHECKING([for GNU or BSD tar])
 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
diff --git a/instsetoo_native/CustomTarget_install.mk 
b/instsetoo_native/CustomTarget_install.mk
index 1dd705217c63..0dab73ad904c 100644
--- a/instsetoo_native/CustomTarget_install.mk
+++ b/instsetoo_native/CustomTarget_install.mk
@@ -85,6 +85,7 @@ $(foreach pkgformat,$(5),\
        -l $(subst $(WHITESPACE),$(COMMA),$(strip $(2))) \
        -p $(PRODUCTNAME_WITHOUT_SPACES)$(3) \
        -u $(instsetoo_OUT) \
+       -packer $(COMPRESSIONTOOL) \
        -buildid $(if $(filter deb0 
rpm0,$(pkgformat)$(LIBO_VERSION_PATCH)),1,$(LIBO_VERSION_PATCH)) \
        $(if $(filter WNT,$(OS)), \
                -msitemplate $(dir $@)msi_templates \
diff --git a/solenv/bin/modules/installer/download.pm 
b/solenv/bin/modules/installer/download.pm
index b0e414abbd06..ca270fe563a9 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -520,7 +520,7 @@ sub create_tar_gz_file_from_directory
         unlink("$installdir/install");
     }
 
-    my $systemcall = "cd $changedir; $fakerootstring tar -cf - $packdir | gzip 
> $targzname";
+    my $systemcall = "cd $changedir; $fakerootstring tar -cf - $packdir | 
$installer::globals::packertool > $targzname";
 
     my $returnvalue = system($systemcall);
 
diff --git a/solenv/bin/modules/installer/epmfile.pm 
b/solenv/bin/modules/installer/epmfile.pm
index 7a1f5fd94c52..ecddeb395712 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -1839,7 +1839,7 @@ sub create_packages_without_epm
 
     # Solaris: pkgmk -o -f solaris-2.8-sparc/SUNWso8m34.prototype -d 
solaris-2.8-sparc
     # Solaris: pkgtrans solaris-2.8-sparc SUNWso8m34.pkg SUNWso8m34
-    # Solaris: tar -cf - SUNWso8m34 | gzip > SUNWso8m34.tar.gz
+    # Solaris: tar -cf - SUNWso8m34 | $installer::globals::packertool > 
SUNWso8m34.tar.gz
 
     if ( $installer::globals::issolarispkgbuild )
     {
@@ -1983,7 +1983,7 @@ sub create_packages_without_epm
         #########################
 
         # my $targzname = $packagename . ".tar.gz";
-        # $systemcall = "cd $destinationdir; tar -cf - $packagename | gzip > 
$targzname";
+        # $systemcall = "cd $destinationdir; tar -cf - $packagename | 
$installer::globals::packertool > $targzname";
         # print "... $systemcall ...\n";
 
         # $returnvalue = system($systemcall);
diff --git a/solenv/bin/modules/installer/globals.pm 
b/solenv/bin/modules/installer/globals.pm
index 2309a3781b4e..11442ef202a8 100644
--- a/solenv/bin/modules/installer/globals.pm
+++ b/solenv/bin/modules/installer/globals.pm
@@ -129,6 +129,8 @@ BEGIN
 
     $strip = 0;
 
+    $packertool = "gzip";           # the default package compression tool for 
*NIX
+
     $logfilename = "logfile.log";   # the default logfile name for global 
errors
     @logfileinfo = ();
     @errorlogfileinfo = ();
diff --git a/solenv/bin/modules/installer/helppack.pm 
b/solenv/bin/modules/installer/helppack.pm
index 726157be2e27..456e91ecfdb0 100644
--- a/solenv/bin/modules/installer/helppack.pm
+++ b/solenv/bin/modules/installer/helppack.pm
@@ -130,7 +130,7 @@ sub create_tar_gz_file
 
     $packagename =~ s/\.rpm\s*$//;
     my $targzname = $packagename . ".tar.gz";
-    my $systemcall = "cd $installdir; tar -cf - $packagestring | gzip > 
$targzname";
+    my $systemcall = "cd $installdir; tar -cf - $packagestring | 
$installer::globals::packertool > $targzname";
     installer::logger::print_message( "... $systemcall ...\n" );
 
     my $returnvalue = system($systemcall);
diff --git a/solenv/bin/modules/installer/languagepack.pm 
b/solenv/bin/modules/installer/languagepack.pm
index a39769144de6..14a870866128 100644
--- a/solenv/bin/modules/installer/languagepack.pm
+++ b/solenv/bin/modules/installer/languagepack.pm
@@ -128,7 +128,7 @@ sub create_tar_gz_file
 
     $packagename =~ s/\.rpm\s*$//;
     my $targzname = $packagename . ".tar.gz";
-    $systemcall = "cd $installdir; tar -cf - $packagestring | gzip > 
$targzname";
+    $systemcall = "cd $installdir; tar -cf - $packagestring | 
$installer::globals::packertool > $targzname";
     installer::logger::print_message( "... $systemcall ...\n" );
 
     my $returnvalue = system($systemcall);
diff --git a/solenv/bin/modules/installer/parameter.pm 
b/solenv/bin/modules/installer/parameter.pm
index 8c63a341d34d..8f259c3e9a32 100644
--- a/solenv/bin/modules/installer/parameter.pm
+++ b/solenv/bin/modules/installer/parameter.pm
@@ -56,6 +56,7 @@ The following parameter are needed:
 -languagepack : do create a languagepack, no product pack (optional)
 -helppack : do create a helppack, no product pack (optional)
 -strip: Stripping files (Unix only)
+-packer: Path and parameters for tarball packaging tool (default: gzip (Unix 
only))
 -log : Logging all available information (optional)
 
 Examples for Windows:
@@ -127,6 +128,7 @@ sub getparameter
         elsif ($param eq "-helppack") { $installer::globals::helppack = 1;}
         elsif ($param eq "-debian") { $installer::globals::debian = 1; }
         elsif ($param eq "-strip") { $installer::globals::strip = 1; }
+        elsif ($param eq "-packer") { $installer::globals::packertool = 
shift(@ARGV); }
         elsif ($param eq "-destdir")    # new parameter for simple installer
         {
             $installer::globals::rootpath ne "" && die "must set destdir 
before -i or -simple";
diff --git a/solenv/bin/modules/installer/simplepackage.pm 
b/solenv/bin/modules/installer/simplepackage.pm
index b1d3acdf67ac..5ab12978362d 100644
--- a/solenv/bin/modules/installer/simplepackage.pm
+++ b/solenv/bin/modules/installer/simplepackage.pm
@@ -470,7 +470,7 @@ sub create_package
             $fakerootstring = "fakeroot";
         }
 
-        $systemcall = "cd $tempdir; $fakerootstring tar -cf - . | gzip > 
$archive";
+        $systemcall = "cd $tempdir; $fakerootstring tar -cf - . | 
$installer::globals::packertool > $archive";
     }
 
     if ( $makesystemcall )
diff --git a/solenv/bin/modules/installer/worker.pm 
b/solenv/bin/modules/installer/worker.pm
index 8da6b14ba7fe..fb2969f77e1c 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -913,7 +913,7 @@ sub collectpackagemaps
     # Create a tar gz file with all package maps
     my $tarfilename = $subdirname . ".tar";
     my $targzname = $tarfilename . ".gz";
-    $systemcall = "cd $pkgmapdir; tar -cf - $subdirname | gzip > $targzname";
+    $systemcall = "cd $pkgmapdir; tar -cf - $subdirname | 
$installer::globals::packertool > $targzname";
     installer::systemactions::make_systemcall($systemcall);
     installer::systemactions::remove_complete_directory($pkgmapsubdir, 1);
 }

Reply via email to