[Libreoffice-commits] .: solenv/bin

Fridrich Strba fridrich at kemper.freedesktop.org
Mon Dec 13 11:57:27 PST 2010


 solenv/bin/make_installer.pl                         |   67 ++
 solenv/bin/modules/installer/control.pm              |    3 
 solenv/bin/modules/installer/globals.pm              |    5 
 solenv/bin/modules/installer/helppack.pm             |  536 +++++++++++++++++++
 solenv/bin/modules/installer/parameter.pm            |    3 
 solenv/bin/modules/installer/scriptitems.pm          |   38 +
 solenv/bin/modules/installer/systemactions.pm        |    1 
 solenv/bin/modules/installer/windows/createfolder.pm |    1 
 solenv/bin/modules/installer/windows/upgrade.pm      |    8 
 solenv/bin/modules/installer/worker.pm               |   27 
 10 files changed, 677 insertions(+), 12 deletions(-)

New commits:
commit 57dfe405c82e0683653e17ba3f6e46bdd8fb8d8e
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Mon Dec 13 20:56:37 2010 +0100

    Teach the perl monster to create helppacks

diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl
index 4c464fa..a4b57e5 100644
--- a/solenv/bin/make_installer.pl
+++ b/solenv/bin/make_installer.pl
@@ -44,6 +44,7 @@ use installer::exiter;
 use installer::files;
 use installer::followme;
 use installer::globals;
+use installer::helppack;
 use installer::javainstaller;
 use installer::languagepack;
 use installer::languages;
@@ -454,6 +455,12 @@ if (! $installer::globals::languagepack)
     if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2b.log", $filesinproductarrayref); }
 }
 
+if (! $installer::globals::helppack)
+{
+    $filesinproductarrayref = installer::scriptitems::remove_Helppacklibraries_from_Installset($filesinproductarrayref);
+    if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles2b2.log", $filesinproductarrayref); }
+}
+
 if (! $installer::globals::patch)
 {
     $filesinproductarrayref = installer::scriptitems::remove_patchonlyfiles_from_Installset($filesinproductarrayref);
@@ -645,6 +652,17 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
         else { $installer::globals::makedownload = 0; }
     }
 
+    if ( $installer::globals::helppack )
+    {
+        $installer::globals::addchildprojects = 0;
+        $installer::globals::addsystemintegration = 0;
+        $installer::globals::makejds = 0;
+        $installer::globals::addlicensefile = 0;
+
+        if ( $allvariableshashref->{'OPENSOURCE'} ) { $installer::globals::makedownload = 1; }
+        else { $installer::globals::makedownload = 0; }
+    }
+
     ############################################################
     # Beginning of language specific logging mechanism
     # Until now only global logging into default: logfile.txt
@@ -898,7 +916,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
     if ( $allvariableshashref->{'SERVICESPROJEKT'} )
     {
-        if (! $installer::globals::languagepack)
+        if (! $installer::globals::languagepack && ! $installer::globals::helppack)
         {		
             # ATTENTION: For creating the services.rdb it is necessary to execute the native file
             # "regcomp" or "regcomp.exe". Therefore this function can only be executed on the
@@ -920,7 +938,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
     if (!($installer::globals::is_copy_only_project))
     {
-        if (! $installer::globals::languagepack)
+        if (! $installer::globals::languagepack && ! $installer::globals::helppack)
         {		
             installer::logger::print_message( "... merging files into registry database ...\n" );
 
@@ -1023,7 +1041,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
     my $profilesinproductlanguageresolvedarrayref;
     my $profileitemsinproductlanguageresolvedarrayref;
 
-    if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack)))
+    if ((!($installer::globals::is_copy_only_project)) && (!($installer::globals::product =~ /ada/i )) && (!($installer::globals::languagepack)) && (!($installer::globals::helppack)))
     {
         installer::logger::print_message( "... creating profiles ...\n" );
 
@@ -1165,6 +1183,35 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
     }
 
+    # Help pack projects can now start to select the required information
+    if ( $installer::globals::helppack )
+    {
+        $filesinproductlanguageresolvedarrayref = installer::helppack::select_help_items($filesinproductlanguageresolvedarrayref, $languagesarrayref, "File");
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles16b2.log", $filesinproductlanguageresolvedarrayref); }
+        $scpactionsinproductlanguageresolvedarrayref = installer::helppack::select_help_items($scpactionsinproductlanguageresolvedarrayref, $languagesarrayref, "ScpAction");
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productscpactions6b2.log", $scpactionsinproductlanguageresolvedarrayref); }
+        $linksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($linksinproductlanguageresolvedarrayref, $languagesarrayref, "Shortcut");
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productlinks8b2.log", $linksinproductlanguageresolvedarrayref); }
+        $unixlinksinproductlanguageresolvedarrayref = installer::helppack::select_help_items($unixlinksinproductlanguageresolvedarrayref, $languagesarrayref, "Unixlink");
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "unixlinks5b2.log", $unixlinksinproductlanguageresolvedarrayref); }
+        @{$folderitemsinproductlanguageresolvedarrayref} = (); # no folderitems in helppacks
+
+        # Collecting the directories again, to include only the language specific directories
+        ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_from_filesarray($filesinproductlanguageresolvedarrayref);
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforepmlist3ahelppack.log", $directoriesforepmarrayref); }
+        ($directoriesforepmarrayref, $alldirectoryhash) = installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref, $alldirectoryhash);
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforepmlist3bhelppack.log", $directoriesforepmarrayref); }
+        installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref, "HostName");
+        if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforepmlist3chelppack.log", $directoriesforepmarrayref); }
+
+        if ( $installer::globals::iswindowsbuild )
+        {
+            $registryitemsinproductlanguageresolvedarrayref = installer::worker::select_helppack_items($registryitemsinproductlanguageresolvedarrayref, "RegistryItem");
+            if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems3aa2.log", $registryitemsinproductlanguageresolvedarrayref); }
+        }
+
+    }
+
     # Collecting all files without flag PATCH (for maintenance reasons)
     if ( $installer::globals::patch ) { installer::worker::collect_all_files_without_patch_flag($filesinproductlanguageresolvedarrayref); }
 
@@ -1325,6 +1372,11 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
             
             if ( $installer::globals::languagepack ) { installer::languagepack::replace_languagestring_variable($onepackage, $languagestringref); }
     
+            # checking, if this is a help pack
+            # Creating help packs only, if $installer::globals::helppack is set. Parameter: -helppack
+
+            if ( $installer::globals::helppack ) { installer::helppack::replace_languagestring_variable($onepackage, $languagestringref); }
+
             my $onepackagename = $onepackage->{'module'};			# name of the top module (required)
 
             my $shellscriptsfilename = "";
@@ -1368,6 +1420,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
                 my $oldpackagename = $packagename;
                 $installer::globals::add_required_package = $oldpackagename;	# the link rpm requires the non-linked version
                 if ( $installer::globals::languagepack ) { $packagename = $packagename . "_u"; }
+                elsif ( $installer::globals::helppack ) { $packagename = $packagename . "_v"; } # wtf...
                 else { $packagename = $packagename . "u"; }
                 my $savestring = $oldpackagename . "\t" . $packagename;
                 push(@installer::globals::linkrpms, $savestring);
@@ -1389,6 +1442,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
             if (( $installer::globals::patch ) || 
                 ( $installer::globals::languagepack ) ||
+                ( $installer::globals::helppack ) ||
                 ( $installer::globals::packageformat eq "native" ) ||
                 ( $installer::globals::packageformat eq "portable" ) || 
                 ( $installer::globals::packageformat eq "osx" )) { $allvariableshashref->{'POOLPRODUCT'} = 0; }
@@ -1760,7 +1814,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
             if ( $installer::globals::isxpdplatform )
             {
-                if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::patch ))
+                if (( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack ) && ( ! $installer::globals::patch ))
                 {
                     if (( $allvariableshashref->{'XPDINSTALLER'} ) && ( $installer::globals::call_epm != 0 ))
                     {
@@ -2072,7 +2126,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
                         
             installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir, $onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles, $allvariableshashref);
 
-            if ( ! $installer::globals::languagepack )
+            if ( ! $installer::globals::languagepack && ! $installer::globals::helppack )
             {
                 # For multilingual installation sets, the dialog for the language selection can now be prepared, with 
                 # a checkbox for each available language. This has to happen before the following translation.
@@ -2184,7 +2238,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
 
             # setting patch codes to detect installed products
 
-            if (( $installer::globals::patch ) || ( $installer::globals::languagepack ) || ( $allvariableshashref->{'PDFCONVERTER'} )) { installer::windows::patch::update_patch_tables($languageidtdir, $allvariableshashref); }
+            if (( $installer::globals::patch ) || ( $installer::globals::languagepack ) || ( $installer::globals::helppack ) || ( $allvariableshashref->{'PDFCONVERTER'} )) { installer::windows::patch::update_patch_tables($languageidtdir, $allvariableshashref); }
 
             # Adding Windows Installer CustomActions
 
@@ -2351,6 +2405,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ )
         my $create_download = 0;
         my $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "downloadname");
         if ( $installer::globals::languagepack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "langpackdownloadname"); }
+        if ( $installer::globals::helppack ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "helppackdownloadname"); }
         if ( $installer::globals::patch ) { $downloadname = installer::ziplist::getinfofromziplist($allsettingsarrayref, "patchdownloadname"); }
 
         if ( $is_success ) { installer::followme::save_followme_info($finalinstalldir, $includepatharrayref, $allvariableshashref, $$downloadname, $languagestringref, $languagesarrayref, $current_install_number, $loggingdir, $installlogdir); }
diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm
index 1b2ea07..ad5478a 100644
--- a/solenv/bin/modules/installer/control.pm
+++ b/solenv/bin/modules/installer/control.pm
@@ -428,6 +428,7 @@ sub determine_ship_directory
     }
 
     if ( $installer::globals::languagepack ) { $productstring = $productstring . "_languagepack"; }
+    if ( $installer::globals::helppack ) { $productstring = $productstring . "_helppack"; }
     if ( $installer::globals::patch ) { $productstring = $productstring . "_patch"; }
     
     my $destdir = $shipdrive . $installer::globals::separator . $installer::globals::compiler . 
@@ -700,6 +701,7 @@ sub set_addjavainstaller
         
     if ( $installer::globals::patch ) {	$installer::globals::addjavainstaller = 0; }
     if ( $installer::globals::languagepack ) { $installer::globals::addjavainstaller = 0; }
+    if ( $installer::globals::helppack ) { $installer::globals::addjavainstaller = 0; }
     if ( $allvariableshashref->{'XPDINSTALLER'} ) {	$installer::globals::addjavainstaller = 0; }
 
     my $infoline = "Value of \$installer::globals::addjavainstaller: $installer::globals::addjavainstaller\n";
@@ -718,6 +720,7 @@ sub set_addsystemintegration
     
     if ( $installer::globals::patch ) {	$installer::globals::addsystemintegration = 0; }
     if ( $installer::globals::languagepack ) { $installer::globals::addsystemintegration = 0; }
+    if ( $installer::globals::helppack ) { $installer::globals::addsystemintegration = 0; }
     if (( $installer::globals::packageformat eq "native" ) || ( $installer::globals::packageformat eq "portable" )) { $installer::globals::addsystemintegration = 0; }
 
     my $infoline = "Value of \$installer::globals::addsystemintegration: $installer::globals::addsystemintegration\n";
diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm
index 7b2400d..80b5940 100644
--- a/solenv/bin/modules/installer/globals.pm
+++ b/solenv/bin/modules/installer/globals.pm
@@ -190,7 +190,7 @@ BEGIN
     %alllangmodules = ();
     $englishlicenseset = 0;
     $englishlicense = "";
-    $englishsolarislicensename = "LICENSE";
+    $englishsolarislicensename = "LICENSE_en-US";
     $solarisdontcompress = 0;
     $patharray = "";
     
@@ -324,6 +324,7 @@ BEGIN
     @binarytableonlyfiles = ();
     @allscpactions = ();
     $languagepackaddon = "LanguagePack";
+    $helppackaddon = "HelpPack";
     $patchaddon = "Patch";
     $ooodownloadfilename = "";
     $downloadfilename = "";
@@ -341,6 +342,7 @@ BEGIN
     $patch_user_dir = 0;
     $addchildprojects = 0;
     $languagepack = 0;
+    $helppack = 0;
     $tab = 0;
     $patch = 0;
     $patchincludepath = "";
@@ -456,6 +458,7 @@ BEGIN
     @regcompjars = ( "unoil.jar", "java_uno.jar", "ridl.jar", "jurt.jar", "juh.jar", "xmerge.jar", "commonwizards.jar" );
     @regcompregisterlibs = ( "javavm.uno", "javaloader.uno", "stocservices.uno" );
     @languagepackfeature =();
+    @helppackfeature =();
     @featurecollector =();
     $msiassemblyfiles = "";
     $nsisfilename = "Nsis";
diff --git a/solenv/bin/modules/installer/helppack.pm b/solenv/bin/modules/installer/helppack.pm
new file mode 100644
index 0000000..e12e2da
--- /dev/null
+++ b/solenv/bin/modules/installer/helppack.pm
@@ -0,0 +1,536 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+package installer::helppack;
+
+use installer::converter;
+use installer::existence;
+use installer::files;
+use installer::globals;
+use installer::logger;
+use installer::pathanalyzer;
+use installer::scpzipfiles;
+use installer::scriptitems;
+use installer::systemactions;
+use installer::worker;
+
+sub select_help_items
+{
+    my ( $itemsref, $languagesarrayref, $itemname ) = @_;
+
+    installer::logger::include_header_into_logfile("Selecting items for help pack. Item: $itemname");
+
+    my @itemsarray = ();
+
+    for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
+    {
+        my $oneitem = ${$itemsref}[$i];
+
+        my $ismultilingual = $oneitem->{'ismultilingual'};
+        
+        if (!($ismultilingual))
+        {
+            # Files with style "HELPPACK" and "FORCEHELPPACK" also have to be included into the help pack.
+            # Files with style "HELPPACK" are only included into help packs.
+            # Files with style "FORCEHELPPACK" are included into help packs and non help packs. They are
+            # forced, because otherwise they not not be included into helppacks.
+            
+            my $styles = "";
+            if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
+            
+            if (( $styles =~ /\bHELPPACK\b/ ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) { push(@itemsarray, $oneitem); }
+                    
+            next; 	# single language files are not included into help pack
+        }
+
+    if (0) {
+        my $specificlanguage = "";
+        if ( $oneitem->{'specificlanguage'} ) { $specificlanguage = $oneitem->{'specificlanguage'}; }
+        
+        for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ )	# iterating over all languages
+        {
+            my $onelanguage = ${$languagesarrayref}[$j];
+            my $locallang = $onelanguage;
+            $locallang =~ s/-/_/;
+            
+            if ( $specificlanguage eq $onelanguage )
+            {
+                push(@itemsarray, $oneitem); 	
+            }
+        }
+    }
+    }
+
+    return \@itemsarray;
+}
+
+sub replace_languagestring_variable
+{
+    my ($onepackageref, $languagestringref) = @_;
+
+    my $key;
+
+    foreach $key (keys %{$onepackageref})
+    {
+        my $value = $onepackageref->{$key};
+        $value =~ s/\%LANGUAGESTRING/$$languagestringref/g;
+        $onepackageref->{$key} = $value;			
+    }
+}
+
+#########################################################
+# Including the license text into the script template 
+#########################################################
+
+sub put_license_file_into_script
+{
+    my ($scriptfile, $licensefile) = @_;
+
+    my $infoline = "Adding licensefile into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    my $includestring = "";
+
+    for ( my $i = 0; $i <= $#{$licensefile}; $i++ )
+    {
+        $includestring = $includestring . ${$licensefile}[$i];
+    }
+
+    for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
+    {
+        ${$scriptfile}[$i] =~ s/LICENSEFILEPLACEHOLDER/$includestring/;
+    }
+}
+
+#########################################################
+# Creating a tar.gz file from a Solaris package
+#########################################################
+
+sub create_tar_gz_file
+{
+    my ($installdir, $packagename, $packagestring) = @_;
+    
+    $packagename =~ s/\.rpm\s*$//;
+    my $targzname = $packagename . ".tar.gz";
+    $systemcall = "cd $installdir; tar -cf - $packagestring | gzip > $targzname";
+    installer::logger::print_message( "... $systemcall ...\n" );
+
+    my $returnvalue = system($systemcall);
+
+    my $infoline = "Systemcall: $systemcall\n";
+    push( @installer::globals::logfileinfo, $infoline);
+        
+    if ($returnvalue)
+    {
+        $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
+        push( @installer::globals::logfileinfo, $infoline);
+    }
+    else
+    {
+        $infoline = "Success: Executed \"$systemcall\" successfully!\n";
+        push( @installer::globals::logfileinfo, $infoline);
+    }
+    
+    return $targzname;
+}
+
+#########################################################
+# Determining the name of the package file 
+#########################################################
+
+sub get_packagename_from_packagelist
+{
+    my ( $alldirs, $allvariables, $languagestringref ) = @_;
+    
+    # my $packagename = "";
+
+    # for ( my $i = 0; $i <= $#{$alldirs}; $i++ )
+    # {
+    #	if ( ${$alldirs}[$i] =~ /-fonts/ ) { next; } 
+    #	if ( ${$alldirs}[$i] =~ /-help/ ) { next; } 
+    #	if ( ${$alldirs}[$i] =~ /-res/ ) { next; } 
+    #
+    #	$packagename = ${$alldirs}[$i];
+    #	last;
+    # }
+
+    # if ( $packagename eq "" ) { installer::exiter::exit_program("ERROR: Could not find base package in directory $installdir!", "get_packagename_from_packagelist"); } 
+
+    my $localproductname = $allvariables->{'PRODUCTNAME'};
+    $localproductname = lc($localproductname);
+    $localproductname =~ s/ //g;
+    $localproductname =~ s/-/_/g;
+
+    my $packagename = $localproductname . "_" . $$languagestringref;
+
+    return $packagename;
+}
+
+#########################################################
+# Determining the name of the package file or the rpm
+# in the installation directory. For help packs
+# there is only one file in this directory 
+#########################################################
+
+sub determine_packagename
+{
+    my ( $installdir, $allvariables, $languagestringref ) = @_;
+    
+    my $packagename = "";
+    my $allnames = "";
+    
+    if ( $installer::globals::isrpmbuild )
+    {
+        # determining the rpm file in directory $installdir
+            
+        my $fileextension = "rpm";
+        my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $installdir);
+        if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } 
+        my $rpmsav = installer::converter::copy_array_from_references($rpmfiles);
+        for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); }
+
+        $packagename = get_packagename_from_packagelist($rpmfiles, $allvariables, $languagestringref);
+
+        my $packagestring = installer::converter::convert_array_to_space_separated_string($rpmfiles);
+        $packagename = create_tar_gz_file($installdir, $packagename, $packagestring);	# only one file
+        for ( my $i = 0; $i <= $#{$rpmsav}; $i++ )
+        {
+            my $onefile = $installdir . $installer::globals::separator . ${$rpmsav}[$i];
+            unlink($onefile);
+        }
+        
+        $allnames = $rpmfiles;
+    }
+
+    if ( $installer::globals::issolarisbuild )
+    {
+        # determining the Solaris package file in directory $installdir
+        my $alldirs = installer::systemactions::get_all_directories($installdir);
+
+        if ( ! ( $#{$alldirs} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } 
+        my $alldirssav = installer::converter::copy_array_from_references($alldirs);
+        for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$alldirs}[$i]); }
+
+        $packagename = get_packagename_from_packagelist($alldirs, $allvariables, $languagestringref);
+        my $packagestring = installer::converter::convert_array_to_space_separated_string($alldirs);
+        $packagename = create_tar_gz_file($installdir, $packagename, $packagestring);	# only a file (not a directory) can be included into the shell script
+        for ( my $i = 0; $i <= $#{$alldirssav}; $i++ ) { installer::systemactions::remove_complete_directory(${$alldirssav}[$i], 1); }
+        $allnames = $alldirs;
+    }
+    
+    my $infoline = "Found package in installation directory $installdir : $packagename\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    return ( $packagename, $allnames);
+}
+
+#########################################################
+# Including the name of the package file or the rpm
+# into the script template 
+#########################################################
+
+sub put_packagename_into_script
+{
+    my ($scriptfile, $packagename, $allnames) = @_;
+
+    my $localpackagename = $packagename;
+    $localpackagename =~ s/\.tar\.gz//;	# making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea"
+    my $infoline = "Adding packagename $localpackagename into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    my $installline = "";
+
+    if ( $installer::globals::issolarisbuild ) { $installline = "  /usr/sbin/pkgadd -d \$outdir -a \$adminfile"; }
+
+    if ( $installer::globals::isrpmbuild ) { $installline = "  rpm --prefix \$PRODUCTINSTALLLOCATION --replacepkgs -i"; }
+
+    for ( my $i = 0; $i <= $#{$allnames}; $i++ )
+    {
+        if ( $installer::globals::issolarisbuild ) { $installline = $installline . " ${$allnames}[$i]"; }
+
+        if ( $installer::globals::isrpmbuild ) { $installline = $installline . " \$outdir/${$allnames}[$i]"; }
+    }	
+
+    for ( my $j = 0; $j <= $#{$scriptfile}; $j++ )
+    {
+        ${$scriptfile}[$j] =~ s/INSTALLLINES/$installline/;
+    }
+}
+
+##################################################################
+# Including the lowercase product name into the script template 
+##################################################################
+
+sub put_productname_into_script
+{
+    my ($scriptfile, $variableshashref) = @_;
+    
+    my $productname = $variableshashref->{'PRODUCTNAME'};
+    $productname = lc($productname);
+    $productname =~ s/\.//g;	# openoffice.org -> openofficeorg
+    
+    my $infoline = "Adding productname $productname into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
+    {
+        ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/;
+    }
+}
+
+##################################################################
+# Including the full product name into the script template
+# (name and version) 
+##################################################################
+
+sub put_fullproductname_into_script
+{
+    my ($scriptfile, $variableshashref) = @_;
+
+    my $productname = $variableshashref->{'PRODUCTNAME'};
+    my $productversion = "";
+    if ( $variableshashref->{'PRODUCTVERSION'} ) { $productversion = $variableshashref->{'PRODUCTVERSION'}; };
+    my $fullproductname = $productname . " " . $productversion;
+
+    my $infoline = "Adding full productname \"$fullproductname\" into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
+    {
+        ${$scriptfile}[$i] =~ s/FULLPRODUCTNAMELONGPLACEHOLDER/$fullproductname/;
+    }
+}
+
+##################################################################
+# Including the name of the search package (-core01)
+# into the script template 
+##################################################################
+
+sub put_searchpackage_into_script
+{
+    my ($scriptfile, $variableshashref) = @_;
+    
+    my $basispackageprefix = $variableshashref->{'BASISPACKAGEPREFIX'};
+    my $basispackageversion = $variableshashref->{'OOOBASEVERSION'};
+
+    if ( $installer::globals::issolarisbuild ) { $basispackageversion =~ s/\.//g; }	# "3.0" -> "30"
+
+    my $infoline = "Adding basis package prefix $basispackageprefix into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    $infoline = "Adding basis package version $basispackageversion into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
+    {
+        ${$scriptfile}[$i] =~ s/BASISPACKAGEPREFIXPLACEHOLDER/$basispackageprefix/;
+        ${$scriptfile}[$i] =~ s/OOOBASEVERSIONPLACEHOLDER/$basispackageversion/;
+    }
+    
+}
+
+#########################################################
+# Including the linenumber into the script template 
+#########################################################
+
+sub put_linenumber_into_script
+{
+    my ( $scriptfile, $licensefile, $allnames ) = @_;
+    
+    my $linenumber =  $#{$scriptfile} + $#{$licensefile} + 3;	# also adding the content of the license file!
+
+    my $infoline = "Adding linenumber $linenumber into help pack script\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    for ( my $i = 0; $i <= $#{$scriptfile}; $i++ )
+    {
+        ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/;
+    }	
+}
+
+#########################################################
+# Determining the name of the new scriptfile 
+#########################################################
+
+sub determine_scriptfile_name
+{
+    my ( $packagename ) = @_;
+    
+    my $scriptfilename = $packagename;
+    
+#	if ( $installer::globals::isrpmbuild ) { $scriptfilename =~ s/\.rpm\s*$/\.sh/; }
+#	if ( $installer::globals::issolarisbuild ) { $scriptfilename =~ s/\.tar\.gz\s*$/\.sh/; }
+
+    $scriptfilename =~ s/\.tar\.gz\s*$/\.sh/;
+
+    my $infoline = "Setting help pack script file name to $scriptfilename\n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    return $scriptfilename;
+}
+
+#########################################################
+# Saving the script file in the installation directory 
+#########################################################
+
+sub save_script_file
+{
+    my ($installdir, $newscriptfilename, $scriptfile) = @_;
+    
+    $newscriptfilename = $installdir . $installer::globals::separator . $newscriptfilename;
+    installer::files::save_file($newscriptfilename, $scriptfile);
+    
+    my $infoline = "Saving script file $newscriptfilename\n";
+    push( @installer::globals::logfileinfo, $infoline);
+    
+    return $newscriptfilename;
+}
+
+#########################################################
+# Including the binary package into the script 
+#########################################################
+
+sub include_package_into_script
+{
+    my ( $scriptfilename, $installdir, $packagename ) = @_;
+    
+    my $longpackagename = $installdir . $installer::globals::separator . $packagename;
+    my $systemcall = "cat $longpackagename >>$scriptfilename";
+
+    my $returnvalue = system($systemcall);
+
+    my $infoline = "Systemcall: $systemcall\n";
+    push( @installer::globals::logfileinfo, $infoline);
+        
+    if ($returnvalue)
+    {
+        $infoline = "ERROR: Could not execute \"$systemcall\"!\n";
+        push( @installer::globals::logfileinfo, $infoline);
+    }
+    else
+    {
+        $infoline = "Success: Executed \"$systemcall\" successfully!\n";
+        push( @installer::globals::logfileinfo, $infoline);
+    }
+    
+    my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1";
+    system($localcall);
+
+}
+
+#########################################################
+# Removing the binary package 
+#########################################################
+
+sub remove_package
+{
+    my ( $installdir, $packagename ) = @_;
+
+    my $remove_package = 1;
+
+    if ( $ENV{'DONT_REMOVE_PACKAGE'} ) { $remove_package = 0; }
+
+    if ( $remove_package )
+    {
+        my $longpackagename = $installdir . $installer::globals::separator . $packagename;
+        unlink $longpackagename;
+
+        my $infoline = "Removing package: $longpackagename \n";
+        push( @installer::globals::logfileinfo, $infoline);
+    }
+}
+
+####################################################
+# Unix help packs, that are not part of 
+# multilingual installation sets, need a
+# shell script installer
+####################################################
+
+sub build_installer_for_helppack
+{
+    my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_;
+
+    installer::logger::print_message( "... creating shell script installer ...\n" );
+
+    installer::logger::include_header_into_logfile("Creating shell script installer:");
+
+    # find and read setup script template
+    
+    my $scriptfilename = "langpackscript.sh";
+    my $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0);
+    if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "build_installer_for_helppack"); }
+    my $scriptfile = installer::files::read_file($$scriptref);
+
+    my $infoline = "Found  script file $scriptfilename: $$scriptref \n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    # find and read english license file
+    my $licenselanguage = "en-US";					# always english !
+    my $licensefilename = "LICENSE_" . $licenselanguage;
+    my $licenseincludepatharrayref = installer::worker::get_language_specific_include_pathes($includepatharrayref, $licenselanguage);
+
+    my $licenseref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $licenseincludepatharrayref, 0);
+    if ($$licenseref eq "") { installer::exiter::exit_program("ERROR: Could not find License file $licensefilename!", "build_installer_for_helppack"); }
+    my $licensefile = installer::files::read_file($$licenseref);
+
+    $infoline = "Found licensefile $licensefilename: $$licenseref \n";
+    push( @installer::globals::logfileinfo, $infoline);
+
+    # including variables into license file
+    installer::scpzipfiles::replace_all_ziplistvariables_in_file($licensefile, $allvariableshashref);
+
+    # add license text into script template
+    put_license_file_into_script($scriptfile, $licensefile);
+
+    # add rpm or package file name into script template
+    my ( $packagename, $allnames) = determine_packagename($installdir, $allvariableshashref, $languagestringref);
+    put_packagename_into_script($scriptfile, $packagename, $allnames);
+
+    # add product name into script template
+    put_productname_into_script($scriptfile, $allvariableshashref);
+
+    # add product name into script template
+    put_fullproductname_into_script($scriptfile, $allvariableshashref);
+
+    # add product name into script template
+    put_searchpackage_into_script($scriptfile, $allvariableshashref);
+
+    # replace linenumber in script template
+    put_linenumber_into_script($scriptfile, $licensefile, $allnames);
+    
+    # saving the script file
+    my $newscriptfilename = determine_scriptfile_name($packagename);
+    $newscriptfilename = save_script_file($installdir, $newscriptfilename, $scriptfile);
+
+    # include rpm or package into script
+    include_package_into_script($newscriptfilename, $installdir, $packagename);
+    
+    # remove rpm or package
+    remove_package($installdir, $packagename);
+}
+
+1;
diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm
index a0c8ac1..c40bce7 100644
--- a/solenv/bin/modules/installer/parameter.pm
+++ b/solenv/bin/modules/installer/parameter.pm
@@ -69,6 +69,7 @@ The following parameter are needed:
 -ispatchedepm : Usage of a patched (non-standard) epm (opt., non-Windows only)
 -copyproject : is set for projects that are only used for copying (optional)
 -languagepack : do create a languagepack, no product pack (optional)
+-helppack : do create a helppack, no product pack (optional)
 -patch : do create a patch (optional)
 -patchinc: Source for the patch include files (Solaris only)
 -dontstrip: No file stripping (Unix only)
@@ -153,6 +154,7 @@ sub getparameter
         elsif ($param eq "-buildid") { $installer::globals::buildid = shift(@ARGV); }
         elsif ($param eq "-copyproject") { $installer::globals::is_copy_only_project = 1; }
         elsif ($param eq "-languagepack") { $installer::globals::languagepack = 1; }
+        elsif ($param eq "-helppack") { $installer::globals::helppack = 1;}
         elsif ($param eq "-patch") { $installer::globals::patch = 1; }
         elsif ($param eq "-debian") { $installer::globals::debian = 1; }
         elsif ($param eq "-dontstrip") { $installer::globals::strip = 0; }
@@ -666,6 +668,7 @@ sub outputparameter
     }
     if ( $installer::globals::is_copy_only_project ) { push(@output, "This is a copy only project!\n"); }
     if ( $installer::globals::languagepack ) { push(@output, "Creating language pack!\n"); }
+    if ( $installer::globals::helppack ) { push(@output, "Creating help pack!\n"); }
     if ( $installer::globals::patch ) { push(@output, "Creating patch!\n"); }
     push(@output, "########################################################\n");
     
diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm
index d133770..a6efaca 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -1871,6 +1871,44 @@ sub remove_Languagepacklibraries_from_Installset
 }
 
 ############################################################################
+# Removing all help pack files from installation set (files with
+# the style HELPPACK), except this is a help pack.
+############################################################################
+
+sub remove_Helppacklibraries_from_Installset
+{
+    my ($itemsarrayref) = @_;
+
+    if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::remove_Helppacklibraries_from_Installset : $#{$itemsarrayref}"); }
+
+    my $infoline;
+    
+    my @newitemsarray = ();
+        
+    for ( my $i = 0; $i <= $#{$itemsarrayref}; $i++ )
+    {
+        my $oneitem = ${$itemsarrayref}[$i];
+        my $styles = "";
+        if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
+
+        if ( $styles =~ /\bHELPPACK\b/ )
+        {
+            $infoline = "Removing help pack file $oneitem->{'gid'} from the installation set.\n";
+            push( @installer::globals::globallogfileinfo, $infoline);
+
+            next;
+        }
+
+        push(@newitemsarray, $oneitem);
+    }
+
+    $infoline = "\n";
+    push( @installer::globals::globallogfileinfo, $infoline);
+
+    return \@newitemsarray;	
+}
+
+############################################################################
 # Removing all files with flag PATCH_ONLY from installation set.
 # This function is not called during patch creation.
 ############################################################################
diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm
index 596fb09..0e8e15e 100644
--- a/solenv/bin/modules/installer/systemactions.pm
+++ b/solenv/bin/modules/installer/systemactions.pm
@@ -269,6 +269,7 @@ sub create_directories
         }
 
         if ( $installer::globals::languagepack ) { $path = $path . $localproductname . "_languagepack" . $installer::globals::separator; }
+        elsif ( $installer::globals::helppack ) { $path = $path . $localproductname . "_helppack" . $installer::globals::separator; }
         elsif ( $installer::globals::patch ) { $path = $path . $localproductname . "_patch" . $installer::globals::separator; }
         else { $path = $path . $localproductname . $installer::globals::separator; }
 
diff --git a/solenv/bin/modules/installer/windows/createfolder.pm b/solenv/bin/modules/installer/windows/createfolder.pm
index 01bdc81..001ad24 100644
--- a/solenv/bin/modules/installer/windows/createfolder.pm
+++ b/solenv/bin/modules/installer/windows/createfolder.pm
@@ -96,6 +96,7 @@ sub get_createfolder_component
 
     my $onefile = "";
     if ( $installer::globals::languagepack ) { $onefile = get_languagepack_file($filesref, $onedir); }
+    elsif ( $installer::globals::helppack ) { $onefile = installer::existence::get_specified_file($filesref, 'gid_File_Help_Help_Zip'); }
     else { $onefile = installer::existence::get_specified_file($filesref, $globalfilegid); }
 
     return $onefile->{'componentname'};
diff --git a/solenv/bin/modules/installer/windows/upgrade.pm b/solenv/bin/modules/installer/windows/upgrade.pm
index 8713dd5..a678896 100644
--- a/solenv/bin/modules/installer/windows/upgrade.pm
+++ b/solenv/bin/modules/installer/windows/upgrade.pm
@@ -47,7 +47,7 @@ sub create_upgrade_table
     # fix for problematic OOo 1.9 versions
     my $include_ooo_fix = 0;
     my $ooomaxnew = "";
-    if (($installer::globals::product =~ /^\s*OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack ))
+    if (($installer::globals::product =~ /^\s*OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack ))
     {
         $include_ooo_fix = 1;
         $ooomaxnew = "34.0.0";
@@ -102,7 +102,7 @@ sub create_upgrade_table
 
         # also searching for the stub
         
-        if (( $allvariableshashref->{'STUBUPGRADECODE'} ) && ( ! $installer::globals::languagepack ))
+        if (( $allvariableshashref->{'STUBUPGRADECODE'} ) && ( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack ))
         {
             $newline = $allvariableshashref->{'STUBUPGRADECODE'} . "\t" . "1.0" . "\t" . "\t" . "\t" . "1" . "\t" . "\t" . "STUBPRODUCTS" . "\n";
             push(@upgradetable, $newline);
@@ -110,7 +110,7 @@ sub create_upgrade_table
         
         # searching for all older patches and languagepacks (defined in a extra file)
 
-        if (( $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'} ) && ( ! $installer::globals::languagepack ))
+        if (( $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'} ) && ( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack ))
         {
             my $filename = $allvariableshashref->{'REMOVE_UPGRADE_CODE_FILE'};
             my $langpackcodefilename = $installer::globals::idttemplatepath  . $installer::globals::separator . $filename;
@@ -125,7 +125,7 @@ sub create_upgrade_table
 
     # No upgrade for Beta versions!
     
-    if (( $allvariableshashref->{'PRODUCTEXTENSION'} eq "Beta" ) && ( ! $installer::globals::patch ) && ( ! $installer::globals::languagepack ))
+    if (( $allvariableshashref->{'PRODUCTEXTENSION'} eq "Beta" ) && ( ! $installer::globals::patch ) && ( ! $installer::globals::languagepack ) && ( ! $installer::globals::helppack ))
     {
         @upgradetable = ();
         installer::windows::idtglobal::write_idt_header(\@upgradetable, "upgrade");
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index 058241d..08129fc 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -1218,7 +1218,7 @@ sub select_patch_items_without_name
 }
 
 ###########################################################
-# Selecting patch items
+# Selecting langpack items
 ###########################################################
 
 sub select_langpack_items
@@ -1243,6 +1243,31 @@ sub select_langpack_items
 }
 
 ###########################################################
+# Selecting helppack items
+###########################################################
+
+sub select_helppack_items
+{
+    my ( $itemsref, $itemname ) = @_;
+
+    installer::logger::include_header_into_logfile("Selecting RegistryItems for Help Packs");
+
+    my @itemsarray = ();
+
+    for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
+    {
+        my $oneitem = ${$itemsref}[$i];
+
+        # Items with style "HELPPACK" have to be included into the patch			
+        my $styles = "";
+        if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; }
+        if (( $styles =~ /\bHELPPACK\b/ ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) { push(@itemsarray, $oneitem); }
+    }
+    
+    return \@itemsarray;
+}
+
+###########################################################
 # Searching if LICENSE and README, which are not removed
 # in select_patch_items are really needed for the patch.
 # If not, they are removed now.


More information about the Libreoffice-commits mailing list