19780544fSAndrew Rist#************************************************************** 29780544fSAndrew Rist# 39780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 49780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 59780544fSAndrew Rist# distributed with this work for additional information 69780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 79780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 89780544fSAndrew Rist# "License"); you may not use this file except in compliance 99780544fSAndrew Rist# with the License. You may obtain a copy of the License at 109780544fSAndrew Rist# 119780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 129780544fSAndrew Rist# 139780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 149780544fSAndrew Rist# software distributed under the License is distributed on an 159780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169780544fSAndrew Rist# KIND, either express or implied. See the License for the 179780544fSAndrew Rist# specific language governing permissions and limitations 189780544fSAndrew Rist# under the License. 199780544fSAndrew Rist# 209780544fSAndrew Rist#************************************************************** 219780544fSAndrew Rist 229780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirpackage installer::ziplist; 25cdf0e10cSrcweir 26cdf0e10cSrcweiruse installer::existence; 27cdf0e10cSrcweiruse installer::exiter; 28cdf0e10cSrcweiruse installer::globals; 29cdf0e10cSrcweiruse installer::logger; 30cdf0e10cSrcweiruse installer::parameter; 31cdf0e10cSrcweiruse installer::remover; 32cdf0e10cSrcweiruse installer::systemactions; 33*6ab8adf6SAndre Fischeruse strict; 34*6ab8adf6SAndre Fischer 35*6ab8adf6SAndre Fischer=head2 read_openoffice_lst_file (#loggingdir) 36*6ab8adf6SAndre Fischer Read the settings and variables from the settings file (typically 'openoffice.lst'). 37*6ab8adf6SAndre Fischer=cut 38*6ab8adf6SAndre Fischersub read_openoffice_lst_file ($$;$) 39*6ab8adf6SAndre Fischer{ 40*6ab8adf6SAndre Fischer my ($filename, $product_name, $loggingdir) = @_; 41*6ab8adf6SAndre Fischer 42*6ab8adf6SAndre Fischer # Read all lines from the settings file. 43*6ab8adf6SAndre Fischer my $ziplistref = installer::files::read_file($filename); 44*6ab8adf6SAndre Fischer 45*6ab8adf6SAndre Fischer # Extract the lines of the settings block for the current product. 46*6ab8adf6SAndre Fischer my ($productblockref, $parent) = installer::ziplist::getproductblock( 47*6ab8adf6SAndre Fischer $ziplistref, $product_name, 1); 48*6ab8adf6SAndre Fischer my ($settingsblockref, undef) = installer::ziplist::getproductblock($productblockref, "Settings", 0); 49*6ab8adf6SAndre Fischer $settingsblockref = installer::ziplist::analyze_settings_block($settingsblockref); 50*6ab8adf6SAndre Fischer 51*6ab8adf6SAndre Fischer # Split into settings and variables. 52*6ab8adf6SAndre Fischer my $allsettingsarrayref = installer::ziplist::get_settings_from_ziplist($settingsblockref); 53*6ab8adf6SAndre Fischer my $allvariablesarrayref = installer::ziplist::get_variables_from_ziplist($settingsblockref); 54*6ab8adf6SAndre Fischer 55*6ab8adf6SAndre Fischer # global product block from zip.lst 56*6ab8adf6SAndre Fischer my ($globalproductblockref, undef) = installer::ziplist::getproductblock( 57*6ab8adf6SAndre Fischer $ziplistref, $installer::globals::globalblock, 0); 58*6ab8adf6SAndre Fischer 59*6ab8adf6SAndre Fischer if ($installer::globals::globallogging && defined $loggingdir) 60*6ab8adf6SAndre Fischer { 61*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "productblock.log", $productblockref); 62*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "settingsblock.log", $settingsblockref); 63*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allsettings1.log", $allsettingsarrayref); 64*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allvariables1.log", $allvariablesarrayref); 65*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "globalproductblock.log", $globalproductblockref); 66*6ab8adf6SAndre Fischer } 67*6ab8adf6SAndre Fischer 68*6ab8adf6SAndre Fischer # Integrate parent values. 69*6ab8adf6SAndre Fischer while (defined $parent) 70*6ab8adf6SAndre Fischer { 71*6ab8adf6SAndre Fischer my $parentproductblockref; 72*6ab8adf6SAndre Fischer ($parentproductblockref, $parent) = installer::ziplist::getproductblock($ziplistref, $parent, 1); 73*6ab8adf6SAndre Fischer my ($parentsettingsblockref, undef) = installer::ziplist::getproductblock( 74*6ab8adf6SAndre Fischer $parentproductblockref, "Settings", 0); 75*6ab8adf6SAndre Fischer $parentsettingsblockref = installer::ziplist::analyze_settings_block($parentsettingsblockref); 76*6ab8adf6SAndre Fischer my $allparentsettingsarrayref = installer::ziplist::get_settings_from_ziplist($parentsettingsblockref); 77*6ab8adf6SAndre Fischer my $allparentvariablesarrayref = installer::ziplist::get_variables_from_ziplist($parentsettingsblockref); 78*6ab8adf6SAndre Fischer if (scalar @$allparentsettingsarrayref > 0) 79*6ab8adf6SAndre Fischer { 80*6ab8adf6SAndre Fischer $allsettingsarrayref = installer::converter::combine_arrays_from_references_first_win( 81*6ab8adf6SAndre Fischer $allsettingsarrayref, 82*6ab8adf6SAndre Fischer $allparentsettingsarrayref) 83*6ab8adf6SAndre Fischer } 84*6ab8adf6SAndre Fischer if (scalar @$allparentvariablesarrayref) 85*6ab8adf6SAndre Fischer { 86*6ab8adf6SAndre Fischer $allvariablesarrayref = installer::converter::combine_arrays_from_references_first_win( 87*6ab8adf6SAndre Fischer $allvariablesarrayref, 88*6ab8adf6SAndre Fischer $allparentvariablesarrayref) 89*6ab8adf6SAndre Fischer } 90*6ab8adf6SAndre Fischer } 91*6ab8adf6SAndre Fischer 92*6ab8adf6SAndre Fischer # Integrate global values. 93*6ab8adf6SAndre Fischer if (scalar @$globalproductblockref) 94*6ab8adf6SAndre Fischer { 95*6ab8adf6SAndre Fischer # settings block from zip.lst 96*6ab8adf6SAndre Fischer my ($globalsettingsblockref, undef) = installer::ziplist::getproductblock( 97*6ab8adf6SAndre Fischer $globalproductblockref, "Settings", 0); 98*6ab8adf6SAndre Fischer 99*6ab8adf6SAndre Fischer # select data from settings block in zip.lst 100*6ab8adf6SAndre Fischer $globalsettingsblockref = installer::ziplist::analyze_settings_block($globalsettingsblockref); 101*6ab8adf6SAndre Fischer 102*6ab8adf6SAndre Fischer my $allglobalsettingsarrayref = installer::ziplist::get_settings_from_ziplist($globalsettingsblockref); 103*6ab8adf6SAndre Fischer my $allglobalvariablesarrayref = installer::ziplist::get_variables_from_ziplist($globalsettingsblockref); 104*6ab8adf6SAndre Fischer 105*6ab8adf6SAndre Fischer if ($installer::globals::globallogging && defined $loggingdir) 106*6ab8adf6SAndre Fischer { 107*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "globalsettingsblock1.log", $globalsettingsblockref); 108*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "globalsettingsblock2.log", $globalsettingsblockref); 109*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allglobalsettings1.log", $allglobalsettingsarrayref); 110*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allglobalvariables1.log", $allglobalvariablesarrayref); 111*6ab8adf6SAndre Fischer } 112*6ab8adf6SAndre Fischer 113*6ab8adf6SAndre Fischer if (scalar @$allglobalsettingsarrayref > 0) 114*6ab8adf6SAndre Fischer { 115*6ab8adf6SAndre Fischer $allsettingsarrayref = installer::converter::combine_arrays_from_references_first_win( 116*6ab8adf6SAndre Fischer $allsettingsarrayref, $allglobalsettingsarrayref); 117*6ab8adf6SAndre Fischer } 118*6ab8adf6SAndre Fischer if (scalar @$allglobalvariablesarrayref > 0) 119*6ab8adf6SAndre Fischer { 120*6ab8adf6SAndre Fischer $allvariablesarrayref = installer::converter::combine_arrays_from_references_first_win( 121*6ab8adf6SAndre Fischer $allvariablesarrayref, $allglobalvariablesarrayref); 122*6ab8adf6SAndre Fischer } 123*6ab8adf6SAndre Fischer } 124*6ab8adf6SAndre Fischer 125*6ab8adf6SAndre Fischer # Remove multiples (and the trailing ##%##). 126*6ab8adf6SAndre Fischer $allsettingsarrayref = installer::ziplist::remove_multiples_from_ziplist($allsettingsarrayref); 127*6ab8adf6SAndre Fischer $allvariablesarrayref = installer::ziplist::remove_multiples_from_ziplist($allvariablesarrayref); 128*6ab8adf6SAndre Fischer installer::ziplist::replace_variables_in_ziplist_variables($allvariablesarrayref); 129*6ab8adf6SAndre Fischer 130*6ab8adf6SAndre Fischer # Transform array into hash. 131*6ab8adf6SAndre Fischer my $allvariableshashref = installer::converter::convert_array_to_hash($allvariablesarrayref); 132*6ab8adf6SAndre Fischer 133*6ab8adf6SAndre Fischer # Postprocess the variables. 134*6ab8adf6SAndre Fischer installer::ziplist::set_default_productversion_if_required($allvariableshashref); 135*6ab8adf6SAndre Fischer installer::ziplist::add_variables_to_allvariableshashref($allvariableshashref); 136*6ab8adf6SAndre Fischer installer::ziplist::overwrite_ooovendor($allvariableshashref); 137*6ab8adf6SAndre Fischer 138*6ab8adf6SAndre Fischer if ($installer::globals::globallogging && defined $loggingdir) 139*6ab8adf6SAndre Fischer { 140*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allsettings2.log" ,$allsettingsarrayref); 141*6ab8adf6SAndre Fischer installer::files::save_file($loggingdir . "allvariables2.log" ,$allvariablesarrayref); 142*6ab8adf6SAndre Fischer } 143*6ab8adf6SAndre Fischer 144*6ab8adf6SAndre Fischer # Eventually we should fix this so that we don't have to return the raw arrays, only the resulting hashes. 145*6ab8adf6SAndre Fischer return ($allvariableshashref, $allsettingsarrayref); 146*6ab8adf6SAndre Fischer} 147*6ab8adf6SAndre Fischer 148cdf0e10cSrcweir 149cdf0e10cSrcweir################################################# 150cdf0e10cSrcweir# Getting data from path file and zip list file 151cdf0e10cSrcweir################################################# 152cdf0e10cSrcweir 153cdf0e10cSrcweirsub getproductblock 154cdf0e10cSrcweir{ 155cdf0e10cSrcweir my ($fileref, $search, $inheritance) = @_; 156cdf0e10cSrcweir 157cdf0e10cSrcweir my @searchblock = (); 158cdf0e10cSrcweir my $searchexists = 0; 159cdf0e10cSrcweir my $record = 0; 160cdf0e10cSrcweir my $count = 0; 161cdf0e10cSrcweir my $line; 162cdf0e10cSrcweir my $inh = $inheritance ? '(?::\s*(\S+)\s*)?' : ""; 163cdf0e10cSrcweir my $parent; 164cdf0e10cSrcweir 165cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$fileref}; $i++ ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir $line = ${$fileref}[$i]; 168cdf0e10cSrcweir 169cdf0e10cSrcweir if ( $line =~ /^\s*\Q$search\E\s*$inh$/i ) # case insensitive 170cdf0e10cSrcweir { 171cdf0e10cSrcweir $record = 1; 172cdf0e10cSrcweir $searchexists = 1; 173cdf0e10cSrcweir $parent = $1 if $inheritance; 174cdf0e10cSrcweir } 175cdf0e10cSrcweir 176cdf0e10cSrcweir if ($record) 177cdf0e10cSrcweir { 178cdf0e10cSrcweir push(@searchblock, $line); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir if ( ($record) && ($line =~ /\{/) ) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir $count++; 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir if ( ($record) && ($line =~ /\}/) ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir $count--; 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir if ( ($record) && ($line =~ /\}/) && ( $count == 0 ) ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir $record = 0; 194cdf0e10cSrcweir } 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir if (( ! $searchexists ) && ( $search ne $installer::globals::globalblock )) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir if ($search eq $installer::globals::product ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Product $installer::globals::product not defined in $installer::globals::ziplistname", "getproductblock"); 202cdf0e10cSrcweir } 203cdf0e10cSrcweir elsif ($search eq $installer::globals::compiler ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Compiler $installer::globals::compiler not defined in $installer::globals::pathfilename", "getproductblock"); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir else # this is not possible 208cdf0e10cSrcweir { 209cdf0e10cSrcweir installer::exiter::exit_program("ERROR: Unknown value for $search in getproductblock()", "getproductblock"); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir return (\@searchblock, $parent); 214cdf0e10cSrcweir} 215cdf0e10cSrcweir 216cdf0e10cSrcweir############################################### 217cdf0e10cSrcweir# Analyzing the settings in the zip list file 218cdf0e10cSrcweir############################################### 219cdf0e10cSrcweir 220cdf0e10cSrcweirsub analyze_settings_block 221cdf0e10cSrcweir{ 222cdf0e10cSrcweir my ($blockref) = @_; 223cdf0e10cSrcweir 224cdf0e10cSrcweir my @newsettingsblock = (); 225cdf0e10cSrcweir my $compilerstring = ""; 226cdf0e10cSrcweir my $record = 1; 227cdf0e10cSrcweir my $counter = 0; 228cdf0e10cSrcweir 229cdf0e10cSrcweir # Allowed values in settings block: 230cdf0e10cSrcweir # "Settings", "Variables", "unix" (for destination path and logfile) 231cdf0e10cSrcweir # Furthermore allowed values are $installer::globals::build (srx645) and $installer::globals::compiler (pro and nonpro (unxsols4.pro)) 232cdf0e10cSrcweir 233cdf0e10cSrcweir # Comment line in settings block begin with "#" or ";" 234cdf0e10cSrcweir 235cdf0e10cSrcweir if ( $installer::globals::pro ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir $compilerstring = $installer::globals::compiler . ".pro"; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir else 240cdf0e10cSrcweir { 241cdf0e10cSrcweir $compilerstring = $installer::globals::compiler; 242cdf0e10cSrcweir } 243cdf0e10cSrcweir 244cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir my $line = ${$blockref}[$i]; 247cdf0e10cSrcweir my $nextline = ""; 248cdf0e10cSrcweir 249cdf0e10cSrcweir if ( ${$blockref}[$i+1] ) { $nextline = ${$blockref}[$i+1]; } 250cdf0e10cSrcweir 251cdf0e10cSrcweir # removing comment lines 252cdf0e10cSrcweir 253cdf0e10cSrcweir if (($line =~ /^\s*\#/) || ($line =~ /^\s*\;/)) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir next; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir # complete blocks of unknows strings are not recorded 259cdf0e10cSrcweir 260cdf0e10cSrcweir if ((!($line =~ /^\s*\Q$compilerstring\E\s*$/i)) && 261cdf0e10cSrcweir (!($line =~ /^\s*\Q$installer::globals::build\E\s*$/i)) && 262cdf0e10cSrcweir (!($line =~ /^\s*\bSettings\b\s*$/i)) && 263cdf0e10cSrcweir (!($line =~ /^\s*\bVariables\b\s*$/i)) && 264cdf0e10cSrcweir (!($line =~ /^\s*\bunix\b\s*$/i)) && 265cdf0e10cSrcweir ($nextline =~ /^\s*\{\s*$/i)) 266cdf0e10cSrcweir { 267cdf0e10cSrcweir $record = 0; 268cdf0e10cSrcweir next; # continue with next $i 269cdf0e10cSrcweir } 270cdf0e10cSrcweir 271cdf0e10cSrcweir if (!( $record )) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir if ($line =~ /^\s*\{\s*$/i) 274cdf0e10cSrcweir { 275cdf0e10cSrcweir $counter++; 276cdf0e10cSrcweir } 277cdf0e10cSrcweir 278cdf0e10cSrcweir if ($line =~ /^\s*\}\s*$/i) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir $counter--; 281cdf0e10cSrcweir } 282cdf0e10cSrcweir 283cdf0e10cSrcweir if ($counter == 0) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir $record = 1; 286cdf0e10cSrcweir next; # continue with next $i 287cdf0e10cSrcweir } 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir if ($record) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir push(@newsettingsblock, $line); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir return \@newsettingsblock; 297cdf0e10cSrcweir} 298cdf0e10cSrcweir 299cdf0e10cSrcweir######################################## 300cdf0e10cSrcweir# Settings in zip list file 301cdf0e10cSrcweir######################################## 302cdf0e10cSrcweir 303cdf0e10cSrcweirsub get_settings_from_ziplist 304cdf0e10cSrcweir{ 305cdf0e10cSrcweir my ($blockref) = @_; 306cdf0e10cSrcweir 307cdf0e10cSrcweir my @allsettings = (); 308cdf0e10cSrcweir my $isvariables = 0; 309cdf0e10cSrcweir my $counter = 0; 310cdf0e10cSrcweir my $variablescounter = 0; 311cdf0e10cSrcweir 312cdf0e10cSrcweir # Take all settings from the settings block 313cdf0e10cSrcweir # Do not take the variables from the settings block 314cdf0e10cSrcweir # If a setting is defined more than once, take the 315cdf0e10cSrcweir # setting with the largest counter (open brackets) 316cdf0e10cSrcweir 317cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir my $line = ${$blockref}[$i]; 320cdf0e10cSrcweir my $nextline = ""; 321cdf0e10cSrcweir 322cdf0e10cSrcweir if ( ${$blockref}[$i+1] ) { $nextline = ${$blockref}[$i+1]; } 323cdf0e10cSrcweir 324cdf0e10cSrcweir if (($line =~ /^\s*\S+\s*$/i) && 325cdf0e10cSrcweir ($nextline =~ /^\s*\{\s*$/i) && 326cdf0e10cSrcweir (!($line =~ /^\s*Variables\s*$/i))) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir next; 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir if ($line =~ /^\s*Variables\s*$/i) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir # This is a block of variables 334cdf0e10cSrcweir 335cdf0e10cSrcweir $isvariables = 1; 336cdf0e10cSrcweir next; 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir if ($line =~ /^\s*\{\s*$/i) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir if ($isvariables) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir $variablescounter++; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir else 346cdf0e10cSrcweir { 347cdf0e10cSrcweir $counter++; 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir next; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir if ($line =~ /^\s*\}\s*$/i) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir if ($isvariables) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir $variablescounter--; 358cdf0e10cSrcweir 359cdf0e10cSrcweir if ($variablescounter == 0) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir $isvariables = 0; 362cdf0e10cSrcweir } 363cdf0e10cSrcweir } 364cdf0e10cSrcweir else 365cdf0e10cSrcweir { 366cdf0e10cSrcweir $counter--; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir next; 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir if ($isvariables) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir next; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir 377cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 378cdf0e10cSrcweir 379cdf0e10cSrcweir $line .= "\t##$counter##\n"; 380cdf0e10cSrcweir 381cdf0e10cSrcweir push(@allsettings, $line); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir return \@allsettings; 385cdf0e10cSrcweir} 386cdf0e10cSrcweir 387cdf0e10cSrcweir####################################### 388cdf0e10cSrcweir# Variables from zip list file 389cdf0e10cSrcweir####################################### 390cdf0e10cSrcweir 391cdf0e10cSrcweirsub get_variables_from_ziplist 392cdf0e10cSrcweir{ 393cdf0e10cSrcweir my ($blockref) = @_; 394cdf0e10cSrcweir 395cdf0e10cSrcweir my @allvariables = (); 396cdf0e10cSrcweir my $isvariables = 0; 397cdf0e10cSrcweir my $counter = 0; 398cdf0e10cSrcweir my $variablescounter = 0; 399cdf0e10cSrcweir my $countersum = 0; 400cdf0e10cSrcweir 401cdf0e10cSrcweir # Take all variables from the settings block 402cdf0e10cSrcweir # Do not take the other settings from the settings block 403cdf0e10cSrcweir # If a variable is defined more than once, take the 404cdf0e10cSrcweir # variable with the largest counter (open brackets) 405cdf0e10cSrcweir 406cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir my $line = ${$blockref}[$i]; 409cdf0e10cSrcweir my $nextline = ${$blockref}[$i+1]; 410cdf0e10cSrcweir 411cdf0e10cSrcweir if ($line =~ /^\s*Variables\s*$/i) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir # This is a block of variables 414cdf0e10cSrcweir 415cdf0e10cSrcweir $isvariables = 1; 416cdf0e10cSrcweir next; 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir if ($line =~ /^\s*\{\s*$/i) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir if ($isvariables) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir $variablescounter++; 424cdf0e10cSrcweir } 425cdf0e10cSrcweir else 426cdf0e10cSrcweir { 427cdf0e10cSrcweir $counter++; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir 430cdf0e10cSrcweir next; 431cdf0e10cSrcweir } 432cdf0e10cSrcweir 433cdf0e10cSrcweir if ($line =~ /^\s*\}\s*$/i) 434cdf0e10cSrcweir { 435cdf0e10cSrcweir if ($isvariables) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir $variablescounter--; 438cdf0e10cSrcweir 439cdf0e10cSrcweir if ($variablescounter == 0) 440cdf0e10cSrcweir { 441cdf0e10cSrcweir $isvariables = 0; 442cdf0e10cSrcweir } 443cdf0e10cSrcweir } 444cdf0e10cSrcweir else 445cdf0e10cSrcweir { 446cdf0e10cSrcweir $counter--; 447cdf0e10cSrcweir } 448cdf0e10cSrcweir 449cdf0e10cSrcweir next; 450cdf0e10cSrcweir } 451cdf0e10cSrcweir 452cdf0e10cSrcweir if (!($isvariables)) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir next; 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir $countersum = $counter + $variablescounter; 458cdf0e10cSrcweir 459cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 460cdf0e10cSrcweir 461cdf0e10cSrcweir $line .= "\t##$countersum##\n"; 462cdf0e10cSrcweir 463cdf0e10cSrcweir push(@allvariables, $line); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir 466cdf0e10cSrcweir return \@allvariables; 467cdf0e10cSrcweir} 468cdf0e10cSrcweir 469cdf0e10cSrcweir####################################################################### 470cdf0e10cSrcweir# Removing multiple variables and settings, defined in zip list file 471cdf0e10cSrcweir####################################################################### 472cdf0e10cSrcweir 473cdf0e10cSrcweirsub remove_multiples_from_ziplist 474cdf0e10cSrcweir{ 475cdf0e10cSrcweir my ($blockref) = @_; 476cdf0e10cSrcweir 477cdf0e10cSrcweir # remove all definitions of settings and variables 478cdf0e10cSrcweir # that occur more than once in the zip list file. 479cdf0e10cSrcweir # Take the one with the most open brackets. This 480cdf0e10cSrcweir # number is stored at the end of the string. 481cdf0e10cSrcweir 482cdf0e10cSrcweir my @newarray = (); 483cdf0e10cSrcweir my @itemarray = (); 484cdf0e10cSrcweir my ($line, $itemname, $itemnumber); 485cdf0e10cSrcweir 486cdf0e10cSrcweir # first collecting all variables and settings names 487cdf0e10cSrcweir 488cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir $line = ${$blockref}[$i]; 491cdf0e10cSrcweir 492cdf0e10cSrcweir if ($line =~ /^\s*\b(\S*)\b\s+.*\#\#\d+\#\#\s*$/i) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir $itemname = $1; 495cdf0e10cSrcweir } 496cdf0e10cSrcweir 497cdf0e10cSrcweir if (! installer::existence::exists_in_array($itemname, \@itemarray)) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir push(@itemarray, $itemname); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir } 502cdf0e10cSrcweir 503cdf0e10cSrcweir # and now all $items can be selected with the highest number 504cdf0e10cSrcweir 505cdf0e10cSrcweir for ( my $i = 0; $i <= $#itemarray; $i++ ) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir $itemname = $itemarray[$i]; 508cdf0e10cSrcweir 509cdf0e10cSrcweir my $itemnumbermax = 0; 510cdf0e10cSrcweir my $printline = ""; 511cdf0e10cSrcweir 512cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$blockref}; $j++ ) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir $line = ${$blockref}[$j]; 515cdf0e10cSrcweir 516cdf0e10cSrcweir if ($line =~ /^\s*\Q$itemname\E\s+.*\#\#(\d+)\#\#\s*$/) 517cdf0e10cSrcweir { 518cdf0e10cSrcweir $itemnumber = $1; 519cdf0e10cSrcweir 520cdf0e10cSrcweir if ($itemnumber >= $itemnumbermax) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir $printline = $line; 523cdf0e10cSrcweir $itemnumbermax = $itemnumber; 524cdf0e10cSrcweir } 525cdf0e10cSrcweir } 526cdf0e10cSrcweir } 527cdf0e10cSrcweir 528cdf0e10cSrcweir # removing the ending number from the printline 529cdf0e10cSrcweir # and putting it into the array 530cdf0e10cSrcweir 531cdf0e10cSrcweir $printline =~ s/\#\#\d+\#\#//; 532cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$line); 533cdf0e10cSrcweir push(@newarray, $printline); 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir return \@newarray; 537cdf0e10cSrcweir} 538cdf0e10cSrcweir 539cdf0e10cSrcweir######################################################### 540cdf0e10cSrcweir# Reading one variable defined in the zip list file 541cdf0e10cSrcweir######################################################### 542cdf0e10cSrcweir 543cdf0e10cSrcweirsub getinfofromziplist 544cdf0e10cSrcweir{ 545cdf0e10cSrcweir my ($blockref, $variable) = @_; 546cdf0e10cSrcweir 547cdf0e10cSrcweir my $searchstring = ""; 548cdf0e10cSrcweir my $line; 549cdf0e10cSrcweir 550cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir $line = ${$blockref}[$i]; 553cdf0e10cSrcweir 554cdf0e10cSrcweir if ( $line =~ /^\s*\Q$variable\E\s+(.+?)\s*$/ ) # "?" for minimal matching 555cdf0e10cSrcweir { 556cdf0e10cSrcweir $searchstring = $1; 557cdf0e10cSrcweir last; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir } 560cdf0e10cSrcweir 561cdf0e10cSrcweir return \$searchstring; 562cdf0e10cSrcweir} 563cdf0e10cSrcweir 564cdf0e10cSrcweir#################################################### 565cdf0e10cSrcweir# Replacing variables in include path 566cdf0e10cSrcweir#################################################### 567cdf0e10cSrcweir 568cdf0e10cSrcweirsub replace_all_variables_in_pathes 569cdf0e10cSrcweir{ 570cdf0e10cSrcweir my ( $patharrayref, $variableshashref ) = @_; 571cdf0e10cSrcweir 572cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir my $line = ${$patharrayref}[$i]; 575cdf0e10cSrcweir 576cdf0e10cSrcweir my $key; 577cdf0e10cSrcweir 578cdf0e10cSrcweir foreach $key (keys %{$variableshashref}) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir my $value = $variableshashref->{$key}; 581cdf0e10cSrcweir 582cdf0e10cSrcweir if (( $line =~ /\{$key\}/ ) && ( $value eq "" )) { $line = ".\n"; } 583cdf0e10cSrcweir 584cdf0e10cSrcweir $line =~ s/\{\Q$key\E\}/$value/g; 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir ${$patharrayref}[$i] = $line; 588cdf0e10cSrcweir } 589cdf0e10cSrcweir} 590cdf0e10cSrcweir 591cdf0e10cSrcweir#################################################### 592cdf0e10cSrcweir# Replacing minor in include path 593cdf0e10cSrcweir#################################################### 594cdf0e10cSrcweir 595cdf0e10cSrcweirsub replace_minor_in_pathes 596cdf0e10cSrcweir{ 597cdf0e10cSrcweir my ( $patharrayref ) = @_; 598cdf0e10cSrcweir 599cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir my $line = ${$patharrayref}[$i]; 602cdf0e10cSrcweir 603cdf0e10cSrcweir if ( ! defined $ENV{CWS_WORK_STAMP} and defined $ENV{UPDMINOR} ) 604cdf0e10cSrcweir# if ( $installer::globals::minor ) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir $line =~ s/\{minor\}/$installer::globals::minor/g; 607cdf0e10cSrcweir # no difference for minor and minornonpre (ToDo ?) 608cdf0e10cSrcweir $line =~ s/\{minornonpre\}/$installer::globals::minor/g; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir else # building without a minor 611cdf0e10cSrcweir { 612cdf0e10cSrcweir $line =~ s/\.\{minor\}//g; 613cdf0e10cSrcweir $line =~ s/\.\{minornonpre\}//g; 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir ${$patharrayref}[$i] = $line; 617cdf0e10cSrcweir } 618cdf0e10cSrcweir} 619cdf0e10cSrcweir 620cdf0e10cSrcweir#################################################### 621cdf0e10cSrcweir# Replacing packagetype in include path 622cdf0e10cSrcweir#################################################### 623cdf0e10cSrcweir 624cdf0e10cSrcweirsub replace_packagetype_in_pathes 625cdf0e10cSrcweir{ 626cdf0e10cSrcweir my ( $patharrayref ) = @_; 627cdf0e10cSrcweir 628cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir my $line = ${$patharrayref}[$i]; 631cdf0e10cSrcweir 632cdf0e10cSrcweir if (( $installer::globals::installertypedir ) && ( $line =~ /\{pkgtype\}/ )) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir $line =~ s/\{pkgtype\}/$installer::globals::installertypedir/g; 635cdf0e10cSrcweir } 636cdf0e10cSrcweir 637cdf0e10cSrcweir ${$patharrayref}[$i] = $line; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir} 640cdf0e10cSrcweir 641cdf0e10cSrcweir#################################################### 642cdf0e10cSrcweir# Removing ending separators in pathes 643cdf0e10cSrcweir#################################################### 644cdf0e10cSrcweir 645cdf0e10cSrcweirsub remove_ending_separator 646cdf0e10cSrcweir{ 647cdf0e10cSrcweir my ( $patharrayref ) = @_; 648cdf0e10cSrcweir 649cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir my $line = ${$patharrayref}[$i]; 652cdf0e10cSrcweir 653cdf0e10cSrcweir installer::remover::remove_ending_pathseparator(\$line); 654cdf0e10cSrcweir 655cdf0e10cSrcweir $line =~ s/\s*$//; 656cdf0e10cSrcweir $line = $line . "\n"; 657cdf0e10cSrcweir 658cdf0e10cSrcweir ${$patharrayref}[$i] = $line; 659cdf0e10cSrcweir } 660cdf0e10cSrcweir} 661cdf0e10cSrcweir 662cdf0e10cSrcweir#################################################### 663cdf0e10cSrcweir# Replacing languages in include path 664cdf0e10cSrcweir#################################################### 665cdf0e10cSrcweir 666cdf0e10cSrcweirsub replace_languages_in_pathes 667cdf0e10cSrcweir{ 668cdf0e10cSrcweir my ( $patharrayref, $languagesref ) = @_; 669cdf0e10cSrcweir 670cdf0e10cSrcweir installer::logger::include_header_into_logfile("Replacing languages in include pathes:"); 671cdf0e10cSrcweir 672cdf0e10cSrcweir my @patharray = (); 673cdf0e10cSrcweir my $infoline = ""; 674cdf0e10cSrcweir 675cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir my $line = ${$patharrayref}[$i]; 678cdf0e10cSrcweir 679cdf0e10cSrcweir if ( $line =~ /\$\(LANG\)/ ) 680cdf0e10cSrcweir { 681cdf0e10cSrcweir my $originalline = $line; 682cdf0e10cSrcweir my $newline = ""; 683cdf0e10cSrcweir 684cdf0e10cSrcweir for ( my $j = 0; $j <= $#{$languagesref}; $j++ ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir my $language = ${$languagesref}[$j]; 687cdf0e10cSrcweir $line =~ s/\$\(LANG\)/$language/g; 688cdf0e10cSrcweir push(@patharray ,$line); 689*6ab8adf6SAndre Fischer my $newdir = $line; 690cdf0e10cSrcweir $line = $originalline; 691cdf0e10cSrcweir 692cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$newline); 693cdf0e10cSrcweir 694cdf0e10cSrcweir # Is it necessary to refresh the global array, containing all files of all include pathes? 695cdf0e10cSrcweir if ( -d $newdir ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir # Checking if $newdir is empty 698cdf0e10cSrcweir if ( ! installer::systemactions::is_empty_dir($newdir) ) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir $installer::globals::refresh_includepathes = 1; 701cdf0e10cSrcweir $infoline = "Directory $newdir exists and is not empty. Refreshing global file array is required.\n"; 702b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir else 705cdf0e10cSrcweir { 706cdf0e10cSrcweir $infoline = "Directory $newdir is empty. No refresh of global file array required.\n"; 707b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir } 710cdf0e10cSrcweir else 711cdf0e10cSrcweir { 712cdf0e10cSrcweir $infoline = "Directory $newdir does not exist. No refresh of global file array required.\n"; 713b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir } 716cdf0e10cSrcweir } 717cdf0e10cSrcweir else # not language dependent include path 718cdf0e10cSrcweir { 719cdf0e10cSrcweir push(@patharray ,$line); 720cdf0e10cSrcweir } 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir return \@patharray; 724cdf0e10cSrcweir} 725cdf0e10cSrcweir 726cdf0e10cSrcweir##################################################### 727cdf0e10cSrcweir# Collecting all files from all include paths 728cdf0e10cSrcweir##################################################### 729cdf0e10cSrcweir 730cdf0e10cSrcweirsub list_all_files_from_include_path 731cdf0e10cSrcweir{ 732cdf0e10cSrcweir my ( $patharrayref) = @_; 733cdf0e10cSrcweir 734cdf0e10cSrcweir installer::logger::include_header_into_logfile("Include pathes:"); 735cdf0e10cSrcweir 736cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir my $path = ${$patharrayref}[$i]; 739cdf0e10cSrcweir installer::remover::remove_leading_and_ending_whitespaces(\$path); 740cdf0e10cSrcweir my $infoline = "$path\n"; 741b274bc22SAndre Fischer $installer::logger::Lang->print($infoline); 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744b274bc22SAndre Fischer $installer::logger::Lang->print("\n"); 745cdf0e10cSrcweir} 746cdf0e10cSrcweir 747cdf0e10cSrcweir##################################################### 748cdf0e10cSrcweir# Collecting all files from all include paths 749cdf0e10cSrcweir##################################################### 750cdf0e10cSrcweir 751cdf0e10cSrcweirsub set_manufacturer 752cdf0e10cSrcweir{ 753cdf0e10cSrcweir my ($allvariables) = @_; 754cdf0e10cSrcweir 755599cc5b4SOliver-Rainer Wittmann my $openofficeproductname = "OpenOffice"; 756cdf0e10cSrcweir my $sunname = ""; 757cdf0e10cSrcweir 758cdf0e10cSrcweir 759cdf0e10cSrcweir if ( $allvariables->{'OPENSOURCE'} && $allvariables->{'OPENSOURCE'} == 1 ) 760cdf0e10cSrcweir { 761cdf0e10cSrcweir $installer::globals::isopensourceproduct = 1; 762cdf0e10cSrcweir $installer::globals::manufacturer = $openofficeproductname; 763cdf0e10cSrcweir $installer::globals::longmanufacturer = $openofficeproductname; 764cdf0e10cSrcweir } 765cdf0e10cSrcweir else 766cdf0e10cSrcweir { 767cdf0e10cSrcweir $installer::globals::isopensourceproduct = 0; 768cdf0e10cSrcweir if (( $allvariables->{'DEFINEDMANUFACTURER'} ) && ( $allvariables->{'DEFINEDMANUFACTURER'} ne "" )) { $sunname = $allvariables->{'DEFINEDMANUFACTURER'}; } 769cdf0e10cSrcweir else { installer::exiter::exit_program("ERROR: Property DEFINEDMANUFACTURER has to be set for this product!", "set_manufacturer"); } 770cdf0e10cSrcweir $installer::globals::manufacturer = $sunname; 771cdf0e10cSrcweir $installer::globals::longmanufacturer = $sunname; 772cdf0e10cSrcweir } 773cdf0e10cSrcweir 774cdf0e10cSrcweir $allvariables->{'MANUFACTURER'} = $installer::globals::manufacturer; 775cdf0e10cSrcweir} 776cdf0e10cSrcweir 777cdf0e10cSrcweir############################################################## 778cdf0e10cSrcweir# A ProductVersion has to be defined. If it is not set in 779cdf0e10cSrcweir# zip.lst, it is set now to "1" 780cdf0e10cSrcweir############################################################## 781cdf0e10cSrcweir 782cdf0e10cSrcweirsub set_default_productversion_if_required 783cdf0e10cSrcweir{ 784cdf0e10cSrcweir my ($allvariables) = @_; 785cdf0e10cSrcweir 786cdf0e10cSrcweir if (!($allvariables->{'PRODUCTVERSION'})) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir $allvariables->{'PRODUCTVERSION'} = 1; # FAKE 789cdf0e10cSrcweir } 790cdf0e10cSrcweir} 791cdf0e10cSrcweir 792cdf0e10cSrcweir#################################################### 793cdf0e10cSrcweir# Removing .. in pathes 794cdf0e10cSrcweir#################################################### 795cdf0e10cSrcweir 796cdf0e10cSrcweirsub simplify_path 797cdf0e10cSrcweir{ 798cdf0e10cSrcweir my ( $pathref ) = @_; 799cdf0e10cSrcweir 800cdf0e10cSrcweir my $oldpath = $$pathref; 801cdf0e10cSrcweir 802cdf0e10cSrcweir my $change = 0; 803cdf0e10cSrcweir 804cdf0e10cSrcweir while ( $oldpath =~ /(^.*)(\Q$installer::globals::separator\E.*\w+?)(\Q$installer::globals::separator\E\.\.)(\Q$installer::globals::separator\E.*$)/ ) 805cdf0e10cSrcweir { 806cdf0e10cSrcweir my $part1 = $1; 807cdf0e10cSrcweir my $part2 = $4; 808cdf0e10cSrcweir $oldpath = $part1 . $part2; 809cdf0e10cSrcweir $change = 1; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir 812cdf0e10cSrcweir if ( $change ) { $$pathref = $oldpath . "\n"; } 813cdf0e10cSrcweir} 814cdf0e10cSrcweir 815cdf0e10cSrcweir#################################################### 816cdf0e10cSrcweir# Removing ending separators in pathes 817cdf0e10cSrcweir#################################################### 818cdf0e10cSrcweir 819cdf0e10cSrcweirsub resolve_relative_pathes 820cdf0e10cSrcweir{ 821cdf0e10cSrcweir my ( $patharrayref ) = @_; 822cdf0e10cSrcweir 823cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$patharrayref}; $i++ ) 824cdf0e10cSrcweir { 825cdf0e10cSrcweir installer::parameter::make_path_absolute(\${$patharrayref}[$i]); 826cdf0e10cSrcweir simplify_path(\${$patharrayref}[$i]); 827cdf0e10cSrcweir } 828cdf0e10cSrcweir} 829cdf0e10cSrcweir 830cdf0e10cSrcweir#################################################### 831cdf0e10cSrcweir# Replacing variables inside zip list variables 832cdf0e10cSrcweir# Example: {milestone} to be replaced by 833cdf0e10cSrcweir# $installer::globals::lastminor 834cdf0e10cSrcweir#################################################### 835cdf0e10cSrcweir 836cdf0e10cSrcweirsub replace_variables_in_ziplist_variables 837cdf0e10cSrcweir{ 838cdf0e10cSrcweir my ($blockref) = @_; 839cdf0e10cSrcweir 840cdf0e10cSrcweir my $milestonevariable = $installer::globals::lastminor; 841cdf0e10cSrcweir $milestonevariable =~ s/m//; 842cdf0e10cSrcweir $milestonevariable =~ s/s/\./; 843cdf0e10cSrcweir 844cdf0e10cSrcweir my $localminor = $installer::globals::lastminor; 845cdf0e10cSrcweir if ( $installer::globals::minor ) { $localminor = $installer::globals::minor; } 846cdf0e10cSrcweir 847cdf0e10cSrcweir my $buildidstringcws = $installer::globals::build . $localminor . "(Build:" . $installer::globals::buildid . ")"; 848cdf0e10cSrcweir 849cdf0e10cSrcweir # the environment variable CWS_WORK_STAMP is set only in CWS 850cdf0e10cSrcweir if ( $ENV{'CWS_WORK_STAMP'} ) { $buildidstringcws = $buildidstringcws . "\[CWS\:" . $ENV{'CWS_WORK_STAMP'} . "\]"; } 851cdf0e10cSrcweir 852cdf0e10cSrcweir for ( my $i = 0; $i <= $#{$blockref}; $i++ ) 853cdf0e10cSrcweir { 854cdf0e10cSrcweir if ($installer::globals::lastminor) { ${$blockref}[$i] =~ s/\{milestone\}/$milestonevariable/; } 855cdf0e10cSrcweir else { ${$blockref}[$i] =~ s/\{milestone\}//; } 856cdf0e10cSrcweir if ( $localminor ) { ${$blockref}[$i] =~ s/\{minor\}/$localminor/; } 857cdf0e10cSrcweir else { ${$blockref}[$i] =~ s/\{minor\}//; } 858cdf0e10cSrcweir if ( $installer::globals::buildid ) { ${$blockref}[$i] =~ s/\{buildid\}/$installer::globals::buildid/; } 859cdf0e10cSrcweir else { ${$blockref}[$i] =~ s/\{buildid\}//; } 860cdf0e10cSrcweir if ( $installer::globals::build ) { ${$blockref}[$i] =~ s/\{buildsource\}/$installer::globals::build/; } 861cdf0e10cSrcweir else { ${$blockref}[$i] =~ s/\{build\}//; } 862cdf0e10cSrcweir ${$blockref}[$i] =~ s/\{buildidcws\}/$buildidstringcws/; 863cdf0e10cSrcweir } 864cdf0e10cSrcweir} 865cdf0e10cSrcweir 866cdf0e10cSrcweir########################################################### 867cdf0e10cSrcweir# Overwrite the vendor string in openoffice.lst that is defined in configure 868cdf0e10cSrcweir########################################################### 869cdf0e10cSrcweir 870cdf0e10cSrcweirsub overwrite_ooovendor 871cdf0e10cSrcweir{ 872cdf0e10cSrcweir my ($variableshashref) = @_; 873cdf0e10cSrcweir $variableshashref->{'OOOVENDOR'} = $ENV{'OOO_VENDOR'} , if( defined $ENV{'OOO_VENDOR'} && $ENV{'OOO_VENDOR'} ne "" ); 874cdf0e10cSrcweir} 875cdf0e10cSrcweir 876cdf0e10cSrcweir########################################################### 877cdf0e10cSrcweir# Adding the lowercase variables into the variableshashref 878cdf0e10cSrcweir########################################################### 879cdf0e10cSrcweir 880cdf0e10cSrcweirsub add_variables_to_allvariableshashref 881cdf0e10cSrcweir{ 882cdf0e10cSrcweir my ($variableshashref) = @_; 883cdf0e10cSrcweir 884cdf0e10cSrcweir my $lcvariable = lc($variableshashref->{'PRODUCTNAME'}); 885cdf0e10cSrcweir $variableshashref->{'LCPRODUCTNAME'} = $lcvariable; 886cdf0e10cSrcweir 887cdf0e10cSrcweir if ($variableshashref->{'SHORT_PRODUCTEXTENSION'}) 888cdf0e10cSrcweir { 889cdf0e10cSrcweir $variableshashref->{'LCPRODUCTEXTENSION'} = "\-" . lc($variableshashref->{'SHORT_PRODUCTEXTENSION'}); # including the "-" ! 890cdf0e10cSrcweir } 891cdf0e10cSrcweir else 892cdf0e10cSrcweir { 893cdf0e10cSrcweir $variableshashref->{'LCPRODUCTEXTENSION'} = ""; 894cdf0e10cSrcweir } 895cdf0e10cSrcweir 896*6ab8adf6SAndre Fischer if ($installer::globals::patch) 897*6ab8adf6SAndre Fischer { 898*6ab8adf6SAndre Fischer $variableshashref->{'PRODUCTADDON'} = $installer::globals::patchaddon; 899*6ab8adf6SAndre Fischer } 900*6ab8adf6SAndre Fischer elsif ($installer::globals::languagepack) 901*6ab8adf6SAndre Fischer { 902*6ab8adf6SAndre Fischer $variableshashref->{'PRODUCTADDON'} = $installer::globals::languagepackaddon; 903*6ab8adf6SAndre Fischer } 904*6ab8adf6SAndre Fischer else 905*6ab8adf6SAndre Fischer { 906*6ab8adf6SAndre Fischer $variableshashref->{'PRODUCTADDON'} = ""; 907*6ab8adf6SAndre Fischer } 908cdf0e10cSrcweir 909cdf0e10cSrcweir my $localbuild = $installer::globals::build; 910cdf0e10cSrcweir if ( $localbuild =~ /^\s*(\w+?)(\d+)\s*$/ ) { $localbuild = $2; } # using "680" instead of "src680" 911cdf0e10cSrcweir $variableshashref->{'PRODUCTMAJOR'} = $localbuild; 912cdf0e10cSrcweir 913cdf0e10cSrcweir my $localminor = ""; 914cdf0e10cSrcweir if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; } 915cdf0e10cSrcweir else { $localminor = $installer::globals::lastminor; } 916cdf0e10cSrcweir if ( $localminor =~ /^\s*\w(\d+)\w*\s*$/ ) { $localminor = $1; } 917cdf0e10cSrcweir $variableshashref->{'PRODUCTMINOR'} = $localminor; 918cdf0e10cSrcweir 919cdf0e10cSrcweir $variableshashref->{'PRODUCTBUILDID'} = $installer::globals::buildid; 920cdf0e10cSrcweir $variableshashref->{'SYSTEM_LIBTEXTCAT_DATA'} = $ENV{'SYSTEM_LIBTEXTCAT_DATA'} , if( defined $ENV{'SYSTEM_LIBTEXTCAT_DATA'} && $ENV{'SYSTEM_LIBTEXTCAT_DATA'} ne "" ); 921cdf0e10cSrcweir} 922cdf0e10cSrcweir 923cdf0e10cSrcweir1; 924