languagepack.pm (0374af79) | languagepack.pm (ecafef68) |
---|---|
1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 43 unchanged lines hidden (view full) --- 52 53 my $ismultilingual = $oneitem->{'ismultilingual'}; 54 55 if (!($ismultilingual)) 56 { 57 # Files with style "LANGUAGEPACK" and "FORCELANGUAGEPACK" also have to be included into the language pack. 58 # Files with style "LANGUAGEPACK" are only included into language packs. 59 # Files with style "FORCELANGUAGEPACK" are included into language packs and non language packs. They are | 1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 43 unchanged lines hidden (view full) --- 52 53 my $ismultilingual = $oneitem->{'ismultilingual'}; 54 55 if (!($ismultilingual)) 56 { 57 # Files with style "LANGUAGEPACK" and "FORCELANGUAGEPACK" also have to be included into the language pack. 58 # Files with style "LANGUAGEPACK" are only included into language packs. 59 # Files with style "FORCELANGUAGEPACK" are included into language packs and non language packs. They are |
60 # forced, because otherwise they not not be included into languagepacks. | 60 # forced, because otherwise they will not be included into languagepacks. |
61 62 my $styles = ""; 63 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 64 65 if (( $styles =~ /\bLANGUAGEPACK\b/ ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { push(@itemsarray, $oneitem); } 66 67 next; # single language files are not included into language pack 68 } --- 28 unchanged lines hidden (view full) --- 97 # preparing different modules for Windows Installer language packs 98 # my $underlinelanguage = $specificlanguage; 99 # $underlinelanguage =~ s/-/_/; 100 # if ( $installer::globals::iswindowsbuild ) { $oneitem->{'modules'} = $installer::globals::languagemodulesbase . $underlinelanguage; } 101 102# # no more collecting of language pack feature 103# if (! installer::existence::exists_in_array($oneitem->{'modules'}, \@installer::globals::languagepackfeature)) 104# { | 61 62 my $styles = ""; 63 if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'}; } 64 65 if (( $styles =~ /\bLANGUAGEPACK\b/ ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { push(@itemsarray, $oneitem); } 66 67 next; # single language files are not included into language pack 68 } --- 28 unchanged lines hidden (view full) --- 97 # preparing different modules for Windows Installer language packs 98 # my $underlinelanguage = $specificlanguage; 99 # $underlinelanguage =~ s/-/_/; 100 # if ( $installer::globals::iswindowsbuild ) { $oneitem->{'modules'} = $installer::globals::languagemodulesbase . $underlinelanguage; } 101 102# # no more collecting of language pack feature 103# if (! installer::existence::exists_in_array($oneitem->{'modules'}, \@installer::globals::languagepackfeature)) 104# { |
105# push(@installer::globals::languagepackfeature, $oneitem->{'modules'}); # Collecting all language pack feature | 105# push(@installer::globals::languagepackfeature, $oneitem->{'modules'}); # Collecting all language pack feature |
106# } 107 | 106# } 107 |
108 push(@itemsarray, $oneitem); | 108 push(@itemsarray, $oneitem); |
109 } 110 } 111 } 112 113 return \@itemsarray; 114} 115 116sub replace_languagestring_variable --- 62 unchanged lines hidden (view full) --- 179 $infoline = "Success: Executed \"$systemcall\" successfully!\n"; 180 $installer::logger::Lang->print($infoline); 181 } 182 183 return $targzname; 184} 185 186######################################################### | 109 } 110 } 111 } 112 113 return \@itemsarray; 114} 115 116sub replace_languagestring_variable --- 62 unchanged lines hidden (view full) --- 179 $infoline = "Success: Executed \"$systemcall\" successfully!\n"; 180 $installer::logger::Lang->print($infoline); 181 } 182 183 return $targzname; 184} 185 186######################################################### |
187# Determining the name of the package file | 187# Determining the name of the package file |
188######################################################### 189 190sub get_packagename_from_packagelist 191{ 192 my ( $alldirs, $allvariables, $languagestringref ) = @_; 193 194 # my $packagename = ""; 195 --- 17 unchanged lines hidden (view full) --- 213 my $packagename = $localproductname . "_" . $$languagestringref; 214 215 return $packagename; 216} 217 218######################################################### 219# Determining the name of the package file or the rpm 220# in the installation directory. For language packs | 188######################################################### 189 190sub get_packagename_from_packagelist 191{ 192 my ( $alldirs, $allvariables, $languagestringref ) = @_; 193 194 # my $packagename = ""; 195 --- 17 unchanged lines hidden (view full) --- 213 my $packagename = $localproductname . "_" . $$languagestringref; 214 215 return $packagename; 216} 217 218######################################################### 219# Determining the name of the package file or the rpm 220# in the installation directory. For language packs |
221# there is only one file in this directory | 221# there is only one file in this directory |
222######################################################### 223 224sub determine_packagename 225{ 226 my ( $installdir, $allvariables, $languagestringref ) = @_; 227 228 my $packagename = ""; 229 my $allnames = ""; 230 231 if ( $installer::globals::islinuxrpmbuild ) 232 { 233 # determining the rpm file in directory $installdir 234 235 my $fileextension = "rpm"; 236 my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $installdir); | 222######################################################### 223 224sub determine_packagename 225{ 226 my ( $installdir, $allvariables, $languagestringref ) = @_; 227 228 my $packagename = ""; 229 my $allnames = ""; 230 231 if ( $installer::globals::islinuxrpmbuild ) 232 { 233 # determining the rpm file in directory $installdir 234 235 my $fileextension = "rpm"; 236 my $rpmfiles = installer::systemactions::find_file_with_file_extension($fileextension, $installdir); |
237 if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } | 237 if ( ! ( $#{$rpmfiles} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } |
238 my $rpmsav = installer::converter::copy_array_from_references($rpmfiles); 239 for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); } 240 241 $packagename = get_packagename_from_packagelist($rpmfiles, $allvariables, $languagestringref); 242 243 my $packagestring = installer::converter::convert_array_to_space_separated_string($rpmfiles); 244 $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only one file 245 for ( my $i = 0; $i <= $#{$rpmsav}; $i++ ) --- 5 unchanged lines hidden (view full) --- 251 $allnames = $rpmfiles; 252 } 253 254 if ( $installer::globals::issolarisbuild ) 255 { 256 # determining the Solaris package file in directory $installdir 257 my $alldirs = installer::systemactions::get_all_directories($installdir); 258 | 238 my $rpmsav = installer::converter::copy_array_from_references($rpmfiles); 239 for ( my $i = 0; $i <= $#{$rpmfiles}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$rpmfiles}[$i]); } 240 241 $packagename = get_packagename_from_packagelist($rpmfiles, $allvariables, $languagestringref); 242 243 my $packagestring = installer::converter::convert_array_to_space_separated_string($rpmfiles); 244 $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only one file 245 for ( my $i = 0; $i <= $#{$rpmsav}; $i++ ) --- 5 unchanged lines hidden (view full) --- 251 $allnames = $rpmfiles; 252 } 253 254 if ( $installer::globals::issolarisbuild ) 255 { 256 # determining the Solaris package file in directory $installdir 257 my $alldirs = installer::systemactions::get_all_directories($installdir); 258 |
259 if ( ! ( $#{$alldirs} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } | 259 if ( ! ( $#{$alldirs} > -1 )) { installer::exiter::exit_program("ERROR: Could not find package in directory $installdir!", "determine_packagename"); } |
260 my $alldirssav = installer::converter::copy_array_from_references($alldirs); 261 for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$alldirs}[$i]); } 262 263 $packagename = get_packagename_from_packagelist($alldirs, $allvariables, $languagestringref); 264 my $packagestring = installer::converter::convert_array_to_space_separated_string($alldirs); 265 $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only a file (not a directory) can be included into the shell script 266 for ( my $i = 0; $i <= $#{$alldirssav}; $i++ ) { installer::systemactions::remove_complete_directory(${$alldirssav}[$i], 1); } 267 $allnames = $alldirs; 268 } 269 270 my $infoline = "Found package in installation directory $installdir : $packagename\n"; 271 $installer::logger::Lang->print($infoline); 272 273 return ( $packagename, $allnames); 274} 275 276######################################################### 277# Including the name of the package file or the rpm | 260 my $alldirssav = installer::converter::copy_array_from_references($alldirs); 261 for ( my $i = 0; $i <= $#{$alldirs}; $i++ ) { installer::pathanalyzer::make_absolute_filename_to_relative_filename(\${$alldirs}[$i]); } 262 263 $packagename = get_packagename_from_packagelist($alldirs, $allvariables, $languagestringref); 264 my $packagestring = installer::converter::convert_array_to_space_separated_string($alldirs); 265 $packagename = create_tar_gz_file($installdir, $packagename, $packagestring); # only a file (not a directory) can be included into the shell script 266 for ( my $i = 0; $i <= $#{$alldirssav}; $i++ ) { installer::systemactions::remove_complete_directory(${$alldirssav}[$i], 1); } 267 $allnames = $alldirs; 268 } 269 270 my $infoline = "Found package in installation directory $installdir : $packagename\n"; 271 $installer::logger::Lang->print($infoline); 272 273 return ( $packagename, $allnames); 274} 275 276######################################################### 277# Including the name of the package file or the rpm |
278# into the script template | 278# into the script template |
279######################################################### 280 281sub put_packagename_into_script 282{ 283 my ($scriptfile, $packagename, $allnames) = @_; 284 285 my $localpackagename = $packagename; 286 $localpackagename =~ s/\.tar\.gz//; # making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea" --- 15 unchanged lines hidden (view full) --- 302 303 for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) 304 { 305 ${$scriptfile}[$j] =~ s/INSTALLLINES/$installline/; 306 } 307} 308 309################################################################## | 279######################################################### 280 281sub put_packagename_into_script 282{ 283 my ($scriptfile, $packagename, $allnames) = @_; 284 285 my $localpackagename = $packagename; 286 $localpackagename =~ s/\.tar\.gz//; # making "OOOopenoffice-it-ea.tar.gz" to "OOOopenoffice-it-ea" --- 15 unchanged lines hidden (view full) --- 302 303 for ( my $j = 0; $j <= $#{$scriptfile}; $j++ ) 304 { 305 ${$scriptfile}[$j] =~ s/INSTALLLINES/$installline/; 306 } 307} 308 309################################################################## |
310# Including the lowercase product name into the script template | 310# Including the lowercase product name into the script template |
311################################################################## 312 313sub put_productname_into_script 314{ 315 my ($scriptfile, $variableshashref) = @_; 316 317 my $productname = $variableshashref->{'PRODUCTNAME'}; 318 $productname = lc($productname); --- 5 unchanged lines hidden (view full) --- 324 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 325 { 326 ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; 327 } 328} 329 330################################################################## 331# Including the full product name into the script template | 311################################################################## 312 313sub put_productname_into_script 314{ 315 my ($scriptfile, $variableshashref) = @_; 316 317 my $productname = $variableshashref->{'PRODUCTNAME'}; 318 $productname = lc($productname); --- 5 unchanged lines hidden (view full) --- 324 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 325 { 326 ${$scriptfile}[$i] =~ s/PRODUCTNAMEPLACEHOLDER/$productname/; 327 } 328} 329 330################################################################## 331# Including the full product name into the script template |
332# (name and version) | 332# (name and version) |
333################################################################## 334 335sub put_fullproductname_into_script 336{ 337 my ($scriptfile, $variableshashref) = @_; 338 339 my $productname = $variableshashref->{'PRODUCTNAME'}; 340 my $productversion = ""; --- 6 unchanged lines hidden (view full) --- 347 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 348 { 349 ${$scriptfile}[$i] =~ s/FULLPRODUCTNAMELONGPLACEHOLDER/$fullproductname/; 350 } 351} 352 353################################################################## 354# Including the name of the search package (-core01) | 333################################################################## 334 335sub put_fullproductname_into_script 336{ 337 my ($scriptfile, $variableshashref) = @_; 338 339 my $productname = $variableshashref->{'PRODUCTNAME'}; 340 my $productversion = ""; --- 6 unchanged lines hidden (view full) --- 347 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 348 { 349 ${$scriptfile}[$i] =~ s/FULLPRODUCTNAMELONGPLACEHOLDER/$fullproductname/; 350 } 351} 352 353################################################################## 354# Including the name of the search package (-core01) |
355# into the script template | 355# into the script template |
356################################################################## 357 358sub put_searchpackage_into_script 359{ 360 my ($scriptfile, $variableshashref) = @_; 361 362 my $basispackageprefix = $variableshashref->{'BASISPACKAGEPREFIX'}; 363 my $basispackageversion = $variableshashref->{'OOOBASEVERSION'}; --- 10 unchanged lines hidden (view full) --- 374 { 375 ${$scriptfile}[$i] =~ s/BASISPACKAGEPREFIXPLACEHOLDER/$basispackageprefix/; 376 ${$scriptfile}[$i] =~ s/OOOBASEVERSIONPLACEHOLDER/$basispackageversion/; 377 } 378 379} 380 381######################################################### | 356################################################################## 357 358sub put_searchpackage_into_script 359{ 360 my ($scriptfile, $variableshashref) = @_; 361 362 my $basispackageprefix = $variableshashref->{'BASISPACKAGEPREFIX'}; 363 my $basispackageversion = $variableshashref->{'OOOBASEVERSION'}; --- 10 unchanged lines hidden (view full) --- 374 { 375 ${$scriptfile}[$i] =~ s/BASISPACKAGEPREFIXPLACEHOLDER/$basispackageprefix/; 376 ${$scriptfile}[$i] =~ s/OOOBASEVERSIONPLACEHOLDER/$basispackageversion/; 377 } 378 379} 380 381######################################################### |
382# Including the linenumber into the script template | 382# Including the linenumber into the script template |
383######################################################### 384 385sub put_linenumber_into_script 386{ 387 my ( $scriptfile, $licensefile, $allnames ) = @_; 388 389 my $linenumber = $#{$scriptfile} + $#{$licensefile} + 3; # also adding the content of the license file! 390 391 my $infoline = "Adding linenumber $linenumber into language pack script\n"; 392 $installer::logger::Lang->print($infoline); 393 394 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 395 { 396 ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/; 397 } 398} 399 400######################################################### | 383######################################################### 384 385sub put_linenumber_into_script 386{ 387 my ( $scriptfile, $licensefile, $allnames ) = @_; 388 389 my $linenumber = $#{$scriptfile} + $#{$licensefile} + 3; # also adding the content of the license file! 390 391 my $infoline = "Adding linenumber $linenumber into language pack script\n"; 392 $installer::logger::Lang->print($infoline); 393 394 for ( my $i = 0; $i <= $#{$scriptfile}; $i++ ) 395 { 396 ${$scriptfile}[$i] =~ s/LINENUMBERPLACEHOLDER/$linenumber/; 397 } 398} 399 400######################################################### |
401# Determining the name of the new scriptfile | 401# Determining the name of the new scriptfile |
402######################################################### 403 404sub determine_scriptfile_name 405{ 406 my ( $packagename ) = @_; 407 408 my $scriptfilename = $packagename; 409 --- 4 unchanged lines hidden (view full) --- 414 415 my $infoline = "Setting language pack script file name to $scriptfilename\n"; 416 $installer::logger::Lang->print($infoline); 417 418 return $scriptfilename; 419} 420 421######################################################### | 402######################################################### 403 404sub determine_scriptfile_name 405{ 406 my ( $packagename ) = @_; 407 408 my $scriptfilename = $packagename; 409 --- 4 unchanged lines hidden (view full) --- 414 415 my $infoline = "Setting language pack script file name to $scriptfilename\n"; 416 $installer::logger::Lang->print($infoline); 417 418 return $scriptfilename; 419} 420 421######################################################### |
422# Saving the script file in the installation directory | 422# Saving the script file in the installation directory |
423######################################################### 424 425sub save_script_file 426{ 427 my ($installdir, $newscriptfilename, $scriptfile) = @_; 428 429 $newscriptfilename = $installdir . $installer::globals::separator . $newscriptfilename; 430 installer::files::save_file($newscriptfilename, $scriptfile); 431 432 my $infoline = "Saving script file $newscriptfilename\n"; 433 $installer::logger::Lang->print($infoline); 434 435 return $newscriptfilename; 436} 437 438######################################################### | 423######################################################### 424 425sub save_script_file 426{ 427 my ($installdir, $newscriptfilename, $scriptfile) = @_; 428 429 $newscriptfilename = $installdir . $installer::globals::separator . $newscriptfilename; 430 installer::files::save_file($newscriptfilename, $scriptfile); 431 432 my $infoline = "Saving script file $newscriptfilename\n"; 433 $installer::logger::Lang->print($infoline); 434 435 return $newscriptfilename; 436} 437 438######################################################### |
439# Including the binary package into the script | 439# Including the binary package into the script |
440######################################################### 441 442sub include_package_into_script 443{ 444 my ( $scriptfilename, $installdir, $packagename ) = @_; 445 446 my $longpackagename = $installdir . $installer::globals::separator . $packagename; 447 my $systemcall = "cat $longpackagename >>$scriptfilename"; --- 15 unchanged lines hidden (view full) --- 463 } 464 465 my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1"; 466 system($localcall); 467 468} 469 470######################################################### | 440######################################################### 441 442sub include_package_into_script 443{ 444 my ( $scriptfilename, $installdir, $packagename ) = @_; 445 446 my $longpackagename = $installdir . $installer::globals::separator . $packagename; 447 my $systemcall = "cat $longpackagename >>$scriptfilename"; --- 15 unchanged lines hidden (view full) --- 463 } 464 465 my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1"; 466 system($localcall); 467 468} 469 470######################################################### |
471# Removing the binary package | 471# Removing the binary package |
472######################################################### 473 474sub remove_package 475{ 476 my ( $installdir, $packagename ) = @_; 477 478 my $remove_package = 1; 479 --- 5 unchanged lines hidden (view full) --- 485 unlink $longpackagename; 486 487 my $infoline = "Removing package: $longpackagename \n"; 488 $installer::logger::Lang->print($infoline); 489 } 490} 491 492#################################################### | 472######################################################### 473 474sub remove_package 475{ 476 my ( $installdir, $packagename ) = @_; 477 478 my $remove_package = 1; 479 --- 5 unchanged lines hidden (view full) --- 485 unlink $longpackagename; 486 487 my $infoline = "Removing package: $longpackagename \n"; 488 $installer::logger::Lang->print($infoline); 489 } 490} 491 492#################################################### |
493# Unix language packs, that are not part of | 493# Unix language packs, that are not part of |
494# multilingual installation sets, need a 495# shell script installer 496#################################################### 497 498sub build_installer_for_languagepack 499{ 500 my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_; 501 502 $installer::logger::Info->print("... creating shell script installer ...\n"); 503 504 installer::logger::include_header_into_logfile("Creating shell script installer:"); 505 506 # find and read setup script template 507 508 my $scriptfilename = "langpackscript.sh"; 509 my $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0); 510 if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "build_installer_for_languagepack"); } 511 my $scriptfile = installer::files::read_file($$scriptref); 512 | 494# multilingual installation sets, need a 495# shell script installer 496#################################################### 497 498sub build_installer_for_languagepack 499{ 500 my ($installdir, $allvariableshashref, $includepatharrayref, $languagesarrayref, $languagestringref) = @_; 501 502 $installer::logger::Info->print("... creating shell script installer ...\n"); 503 504 installer::logger::include_header_into_logfile("Creating shell script installer:"); 505 506 # find and read setup script template 507 508 my $scriptfilename = "langpackscript.sh"; 509 my $scriptref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$scriptfilename, $includepatharrayref, 0); 510 if ($$scriptref eq "") { installer::exiter::exit_program("ERROR: Could not find script file $scriptfilename!", "build_installer_for_languagepack"); } 511 my $scriptfile = installer::files::read_file($$scriptref); 512 |
513 my $infoline = "Found script file $scriptfilename: $$scriptref \n"; | 513 my $infoline = "Found script file $scriptfilename: $$scriptref \n"; |
514 $installer::logger::Lang->print($infoline); 515 516 # find and read english license file 517 my $licenselanguage = "en-US"; # always english ! 518 my $licensefilename = "LICENSE"; 519 my $licenseincludepatharrayref = installer::worker::get_language_specific_include_pathes($includepatharrayref, $licenselanguage); 520 521 my $licenseref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $licenseincludepatharrayref, 0); --- 40 unchanged lines hidden --- | 514 $installer::logger::Lang->print($infoline); 515 516 # find and read english license file 517 my $licenselanguage = "en-US"; # always english ! 518 my $licensefilename = "LICENSE"; 519 my $licenseincludepatharrayref = installer::worker::get_language_specific_include_pathes($includepatharrayref, $licenselanguage); 520 521 my $licenseref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$licensefilename, $licenseincludepatharrayref, 0); --- 40 unchanged lines hidden --- |