Author: af
Date: Fri Nov 22 09:36:12 2013
New Revision: 1544451

URL: http://svn.apache.org/r1544451
Log:
123729: Factored out reading of openoffice.lst to its own function.

Modified:
    openoffice/trunk/main/solenv/bin/make_installer.pl
    openoffice/trunk/main/solenv/bin/modules/installer/ziplist.pm

Modified: openoffice/trunk/main/solenv/bin/make_installer.pl
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/make_installer.pl?rev=1544451&r1=1544450&r2=1544451&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/make_installer.pl (original)
+++ openoffice/trunk/main/solenv/bin/make_installer.pl Fri Nov 22 09:36:12 2013
@@ -87,6 +87,58 @@ use installer::worker;
 use installer::xpdinstaller;
 use installer::ziplist;
 
+use strict;
+
+sub GetSetupScriptLines ($$$)
+{
+    my ($allsettingsarrayref, $allvariableshashref, $includepatharrayref) = @_;
+    
+    if ($installer::globals::setupscript_defined_in_productlist)
+    {
+        installer::setupscript::set_setupscript_name($allsettingsarrayref, 
$includepatharrayref);
+    }
+
+    $installer::logger::Info->print( "... analyzing script: 
$installer::globals::setupscriptname ... \n" );
+    installer::logger::globallog("setup script file: 
$installer::globals::setupscriptname");
+    $installer::logger::Info->print( "... analyzing script: 
$installer::globals::setupscriptname ... \n" );
+
+    # Reading the setup script file
+    my $setupscriptref = 
installer::files::read_file($installer::globals::setupscriptname);
+
+    # Resolving variables defined in the zip list file into setup
+    # script.  All the variables are defined in $allvariablesarrayref
+    
installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, 
$allvariableshashref);
+
+    # Resolving %variables defined in the installation object
+    my $allscriptvariablesref = 
installer::setupscript::get_all_scriptvariables_from_installation_object(
+        $setupscriptref,
+        $installer::globals::setupscriptname);
+    
installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref);
+    
installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
+
+    $setupscriptref = 
installer::setupscript::replace_all_setupscriptvariables_in_script(
+        $setupscriptref,
+        $allscriptvariablesref);
+
+    # Adding all variables defined in the installation object into the
+    # hash of all variables.  This is needed if variables are defined
+    # in the installation object, but not in the zip list file.  If
+    # there is a definition in the zip list file and in the
+    # installation object, the installation object is more important
+    
installer::setupscript::add_installationobject_to_variables($allvariableshashref,
 $allscriptvariablesref);
+
+    # Adding also all variables, that must be included into the 
$allvariableshashref.
+    installer::setupscript::add_forced_properties($allvariableshashref);
+
+    # Replacing preset properties, not using the default mechanisms (for 
example for UNIXPRODUCTNAME)
+    installer::setupscript::replace_preset_properties($allvariableshashref);
+
+    # We did this already.  Can this or the other one be removed.
+    
installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, 
$allvariableshashref);
+
+    return $setupscriptref;
+}
+
 #################################################
 # Main program
 #################################################
@@ -334,43 +386,7 @@ installer::control::check_java_for_xpd($
 # Analyzing the setup script
 #####################################
 
-if ($installer::globals::setupscript_defined_in_productlist) { 
installer::setupscript::set_setupscript_name($allsettingsarrayref, 
$includepatharrayref); }
-
-installer::logger::globallog("setup script file: 
$installer::globals::setupscriptname");
-
-$installer::logger::Info->print( "... analyzing script: 
$installer::globals::setupscriptname ... \n" );
-
-my $setupscriptref = 
installer::files::read_file($installer::globals::setupscriptname); # Reading 
the setup script file
-
-# Resolving variables defined in the zip list file into setup script
-# All the variables are defined in $allvariablesarrayref
-
-installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, 
$allvariableshashref);
-
-# Resolving %variables defined in the installation object
-
-my $allscriptvariablesref = 
installer::setupscript::get_all_scriptvariables_from_installation_object($setupscriptref);
-
-installer::setupscript::add_lowercase_productname_setupscriptvariable($allscriptvariablesref);
-
-installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
-
-$setupscriptref = 
installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref,
 $allscriptvariablesref);
-
-# Adding all variables defined in the installation object into the hash of all 
variables.
-# This is needed if variables are defined in the installation object, but not 
in the zip list file.
-# If there is a definition in the zip list file and in the installation 
object, the installation object is more important
-
-installer::setupscript::add_installationobject_to_variables($allvariableshashref,
 $allscriptvariablesref);
-
-# Adding also all variables, that must be included into the 
$allvariableshashref.
-installer::setupscript::add_forced_properties($allvariableshashref);
-
-# Replacing preset properties, not using the default mechanisms (for example 
for UNIXPRODUCTNAME)
-installer::setupscript::replace_preset_properties($allvariableshashref);
-
-installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, 
$allvariableshashref);
-
+my $setupscriptref = GetSetupScriptLines($allsettingsarrayref, 
$allvariableshashref, $includepatharrayref);
 
 installer::logger::log_hashref($allvariableshashref);
 
@@ -656,7 +672,7 @@ for (;1;last) 
        # Resolving include paths (language dependent)
        ################################################
 
-       $includepatharrayref_lang = 
installer::ziplist::replace_languages_in_pathes($includepatharrayref, 
$languagesarrayref);
+       my $includepatharrayref_lang = 
installer::ziplist::replace_languages_in_pathes($includepatharrayref, 
$languagesarrayref);
 
        if ( $installer::globals::refresh_includepathes ) { 
installer::worker::collect_all_files_from_includepathes($includepatharrayref_lang);
 }
 

Modified: openoffice/trunk/main/solenv/bin/modules/installer/ziplist.pm
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/modules/installer/ziplist.pm?rev=1544451&r1=1544450&r2=1544451&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/modules/installer/ziplist.pm (original)
+++ openoffice/trunk/main/solenv/bin/modules/installer/ziplist.pm Fri Nov 22 
09:36:12 2013
@@ -30,6 +30,121 @@ use installer::logger;
 use installer::parameter;
 use installer::remover;
 use installer::systemactions;
+use strict;
+
+=head2 read_openoffice_lst_file (#loggingdir)
+    Read the settings and variables from the settings file (typically 
'openoffice.lst').
+=cut
+sub read_openoffice_lst_file ($$;$)
+{
+    my ($filename, $product_name, $loggingdir) = @_;
+
+    # Read all lines from the settings file.
+    my $ziplistref = installer::files::read_file($filename);
+
+    # Extract the lines of the settings block for the current product.
+    my ($productblockref, $parent) = installer::ziplist::getproductblock(
+        $ziplistref, $product_name, 1);
+    my ($settingsblockref, undef) = 
installer::ziplist::getproductblock($productblockref, "Settings", 0);
+    $settingsblockref = 
installer::ziplist::analyze_settings_block($settingsblockref);
+
+    # Split into settings and variables.
+    my $allsettingsarrayref = 
installer::ziplist::get_settings_from_ziplist($settingsblockref);
+    my $allvariablesarrayref = 
installer::ziplist::get_variables_from_ziplist($settingsblockref);
+    
+    # global product block from zip.lst
+    my ($globalproductblockref, undef) = installer::ziplist::getproductblock(
+        $ziplistref, $installer::globals::globalblock, 0);
+
+    if ($installer::globals::globallogging && defined $loggingdir)
+    {
+        installer::files::save_file($loggingdir . "productblock.log", 
$productblockref);
+        installer::files::save_file($loggingdir . "settingsblock.log", 
$settingsblockref);
+        installer::files::save_file($loggingdir . "allsettings1.log", 
$allsettingsarrayref);
+        installer::files::save_file($loggingdir . "allvariables1.log", 
$allvariablesarrayref);
+        installer::files::save_file($loggingdir . "globalproductblock.log", 
$globalproductblockref);
+    }
+
+    # Integrate parent values.
+    while (defined $parent)
+    {
+        my $parentproductblockref;
+        ($parentproductblockref, $parent) = 
installer::ziplist::getproductblock($ziplistref, $parent, 1);
+        my ($parentsettingsblockref, undef) = 
installer::ziplist::getproductblock(
+            $parentproductblockref, "Settings", 0);
+        $parentsettingsblockref = 
installer::ziplist::analyze_settings_block($parentsettingsblockref);
+        my $allparentsettingsarrayref =        
installer::ziplist::get_settings_from_ziplist($parentsettingsblockref);
+        my $allparentvariablesarrayref = 
installer::ziplist::get_variables_from_ziplist($parentsettingsblockref);
+               if (scalar @$allparentsettingsarrayref > 0)
+        {
+            $allsettingsarrayref = 
installer::converter::combine_arrays_from_references_first_win(
+                $allsettingsarrayref,
+                $allparentsettingsarrayref)
+        }
+               if (scalar @$allparentvariablesarrayref)
+        {
+            $allvariablesarrayref = 
installer::converter::combine_arrays_from_references_first_win(
+                $allvariablesarrayref,
+                $allparentvariablesarrayref)
+        }
+    }
+
+    # Integrate global values.
+    if (scalar @$globalproductblockref)
+    {
+        # settings block from zip.lst
+        my ($globalsettingsblockref, undef) = 
installer::ziplist::getproductblock(
+            $globalproductblockref, "Settings", 0);
+
+        # select data from settings block in zip.lst
+        $globalsettingsblockref = 
installer::ziplist::analyze_settings_block($globalsettingsblockref);
+
+        my $allglobalsettingsarrayref = 
installer::ziplist::get_settings_from_ziplist($globalsettingsblockref);
+        my $allglobalvariablesarrayref = 
installer::ziplist::get_variables_from_ziplist($globalsettingsblockref);
+
+        if ($installer::globals::globallogging && defined $loggingdir)
+        {
+            installer::files::save_file($loggingdir . 
"globalsettingsblock1.log", $globalsettingsblockref);
+            installer::files::save_file($loggingdir . 
"globalsettingsblock2.log", $globalsettingsblockref);
+            installer::files::save_file($loggingdir . 
"allglobalsettings1.log", $allglobalsettingsarrayref);
+            installer::files::save_file($loggingdir . 
"allglobalvariables1.log", $allglobalvariablesarrayref);
+        }
+        
+        if (scalar @$allglobalsettingsarrayref > 0)
+        {
+            $allsettingsarrayref = 
installer::converter::combine_arrays_from_references_first_win(
+                $allsettingsarrayref, $allglobalsettingsarrayref);
+        }
+        if (scalar @$allglobalvariablesarrayref > 0)
+        {
+            $allvariablesarrayref = 
installer::converter::combine_arrays_from_references_first_win(
+                $allvariablesarrayref, $allglobalvariablesarrayref);
+        }
+    }
+
+    # Remove multiples (and the trailing ##%##).
+    $allsettingsarrayref = 
installer::ziplist::remove_multiples_from_ziplist($allsettingsarrayref);
+    $allvariablesarrayref = 
installer::ziplist::remove_multiples_from_ziplist($allvariablesarrayref);
+    
installer::ziplist::replace_variables_in_ziplist_variables($allvariablesarrayref);
+
+    # Transform array into hash.
+    my $allvariableshashref = 
installer::converter::convert_array_to_hash($allvariablesarrayref);
+
+    # Postprocess the variables.
+    
installer::ziplist::set_default_productversion_if_required($allvariableshashref);
+    
installer::ziplist::add_variables_to_allvariableshashref($allvariableshashref);
+    installer::ziplist::overwrite_ooovendor($allvariableshashref);
+    
+    if ($installer::globals::globallogging && defined $loggingdir)
+    {
+        installer::files::save_file($loggingdir . "allsettings2.log" 
,$allsettingsarrayref);
+        installer::files::save_file($loggingdir . "allvariables2.log" 
,$allvariablesarrayref);
+    }
+
+    # Eventually we should fix this so that we don't have to return the raw 
arrays, only the resulting hashes.
+    return ($allvariableshashref, $allsettingsarrayref);
+}
+
 
 #################################################
 # Getting data from path file and zip list file
@@ -571,7 +686,7 @@ sub replace_languages_in_pathes
                                my $language = ${$languagesref}[$j];
                                $line =~ s/\$\(LANG\)/$language/g;
                                push(@patharray ,$line);
-                               $newdir = $line;
+                               my $newdir = $line;
                                $line = $originalline;
                                
                                
installer::remover::remove_leading_and_ending_whitespaces(\$newline);
@@ -627,8 +742,6 @@ sub list_all_files_from_include_path
        }
 
     $installer::logger::Lang->print("\n");
-       
-       return \@filesarray;
 }
 
 #####################################################
@@ -780,9 +893,18 @@ sub add_variables_to_allvariableshashref
                $variableshashref->{'LCPRODUCTEXTENSION'} = "";         
        }
 
-       if ( $installer::globals::patch ) { $variableshashref->{'PRODUCTADDON'} 
= $installer::globals::patchaddon; }
-       elsif ( $installer::globals::languagepack ) { 
$variableshashref->{'PRODUCTADDON'} = $installer::globals::languagepackaddon; }
-       else { $variableshashref->{'PRODUCTADDON'} = ""; }
+       if ($installer::globals::patch)
+    {
+        $variableshashref->{'PRODUCTADDON'} = $installer::globals::patchaddon;
+    }
+       elsif ($installer::globals::languagepack)
+    {
+        $variableshashref->{'PRODUCTADDON'} = 
$installer::globals::languagepackaddon;
+    }
+       else
+    {
+        $variableshashref->{'PRODUCTADDON'} = "";
+    }
 
        my $localbuild = $installer::globals::build;
        if ( $localbuild =~ /^\s*(\w+?)(\d+)\s*$/ ) { $localbuild = $2; }       
# using "680" instead of "src680"


Reply via email to