diff options
author | Andras Timar <atimar@suse.com> | 2012-09-08 20:33:22 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-09-08 20:33:22 +0200 |
commit | e520fa15a5dd1dbee6fd293dc334e90d3244084f (patch) | |
tree | 02889c50f3704e92303b9f0766f162061e7d592e /solenv | |
parent | 15a2c9adca6a0d5dd196e97312c664bc21ae1b6c (diff) |
installer does not produce .inf files, corresponding code can go
Change-Id: I98c134457d113dfbb83074fc7ee48cbf952b17b3
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer.pm | 10 | ||||
-rw-r--r-- | solenv/bin/modules/installer/worker.pm | 360 |
2 files changed, 0 insertions, 370 deletions
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm index e1209cac6ec8..c78225e24580 100644 --- a/solenv/bin/modules/installer.pm +++ b/solenv/bin/modules/installer.pm @@ -972,16 +972,6 @@ sub main { installer::worker::collect_scpactions($scpactionsinproductlanguageresolvedarrayref); - ######################################################### - # creating inf files for user system integration - ######################################################### - - if (( $installer::globals::iswindowsbuild ) && ( ! $installer::globals::patch )) # Windows specific items: Folder, FolderItem, RegistryItem - { - installer::logger::print_message( "... creating inf files ...\n" ); - installer::worker::create_inf_file($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $folderinproductlanguageresolvedarrayref, $folderitemsinproductlanguageresolvedarrayref, $modulesinproductlanguageresolvedarrayref, $languagesarrayref, $languagestringref, $allvariableshashref); - } - ########################################################### # Simple package projects can now start to create the # installation structure by creating Directories, Files diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 933b0b7b63a2..e954971a3de8 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -288,32 +288,6 @@ sub get_language_specific_include_paths } ############################################################## -# Returning the first item with a defined flag -############################################################## - -sub return_first_item_with_special_flag -{ - my ($itemsref, $flag) = @_; - - my $firstitem = ""; - - for ( my $i = 0; $i <= $#{$itemsref}; $i++ ) - { - my $oneitem = ${$itemsref}[$i]; - my $styles = ""; - if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} }; - - if ( $styles =~ /\b$flag\b/ ) - { - $firstitem = $oneitem; - last; - } - } - - return $firstitem; -} - -############################################################## # Collecting all items with a defined flag ############################################################## @@ -515,340 +489,6 @@ sub install_simple ($$$$$$) } ########################################################### -# Adding shellnew files into files collector for -# user installation -########################################################### - -sub add_shellnewfile_into_filesarray -{ - my ($filesref, $onefile, $inffile) = @_; - - my %shellnewfile = (); - my $shellnewfileref = \%shellnewfile; - - installer::converter::copy_item_object($inffile, $shellnewfileref); - - $shellnewfileref->{'Name'} = $onefile->{'Name'}; - $shellnewfileref->{'sourcepath'} = $onefile->{'sourcepath'}; - $shellnewfileref->{'gid'} = $onefile->{'gid'} . "_Userinstall"; - - # the destination has to be adapted - my $destination = $inffile->{'destination'}; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); - $destination = $destination . $onefile->{'Name'}; - $shellnewfileref->{'destination'} = $destination; - - # add language specific inffile into filesarray - push(@{$filesref}, $shellnewfileref); -} - -########################################################### -# Replacing one placehoder in template file -########################################################### - -sub replace_in_template_file -{ - my ($templatefile, $placeholder, $newstring) = @_; - - for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) - { - ${$templatefile}[$i] =~ s/\Q$placeholder\E/$newstring/g; - } -} - -########################################################### -# Replacing one placehoder with an array in template file -########################################################### - -sub replace_array_in_template_file -{ - my ($templatefile, $placeholder, $arrayref) = @_; - - for ( my $i = 0; $i <= $#{$templatefile}; $i++ ) - { - if ( ${$templatefile}[$i] =~ /\Q$placeholder\E/ ) - { - my @return = splice(@{$templatefile}, $i, 1, @{$arrayref}); - } - } -} - -########################################################### -# Collecting all modules from registry items -########################################################### - -sub collect_all_modules -{ - my ($registryitemsref) = @_; - - my @allmodules = (); - - for ( my $i = 0; $i <= $#{$registryitemsref}; $i++ ) - { - $registryitem = ${$registryitemsref}[$i]; - my $module = $registryitem->{'ModuleID'}; - - if ( ! grep {$_ eq $module} @allmodules ) - { - push(@allmodules, $module); - } - } - - return \@allmodules; -} - -########################################################### -# Changing the content of the inf file -########################################################### - -sub write_content_into_inf_file -{ - my ($templatefile, $filesref, $registryitemsref, $folderref, $folderitemsref, $modulesref, $onelanguage, $inffile, $firstlanguage, $allvariableshashref) = @_; - - # First part: Shellnew files - # SHELLNEWFILESPLACEHOLDER - - my $rootmodule = 0; - # inf files can be assigned to "gid_Module_Root_Files_2" - if ( $inffile->{'modules'} =~ /Module_Root/i ) { $rootmodule = 1; } - - if ( $rootmodule ) - { - my $shellnewstring = ""; - - for ( my $i = 0; $i <= $#{$filesref}; $i++ ) - { - my $onefile = ${$filesref}[$i]; - my $directory = $onefile->{'Dir'}; - - if ( $directory =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) - { - $shellnewstring = $shellnewstring . $onefile->{'Name'} . "\n"; - if (( $firstlanguage ) && ( ! $installer::globals::shellnewfilesadded )) { add_shellnewfile_into_filesarray($filesref, $onefile, $inffile); } - } - } - - $shellnewstring =~ s/\s*$//; - replace_in_template_file($templatefile, "SHELLNEWFILESPLACEHOLDER", $shellnewstring); - - $installer::globals::shellnewfilesadded = 1; - } - - # Second part: Start menu entries - - # The OfficeMenuFolder is defined as: $productname . " " . $productversion; - - my $productname = $allvariableshashref->{'PRODUCTNAME'}; - my $productversion = $allvariableshashref->{'PRODUCTVERSION'}; - my $productkey = $productname . " " . $productversion; - - replace_in_template_file($templatefile, "OFFICEFOLDERPLACEHOLDER", $productkey); - - # Setting name target and infotip for all applications - - for ( my $i = 0; $i <= $#{$folderitemsref}; $i++ ) - { - my $folderitem = ${$folderitemsref}[$i]; - - my $styles = ""; - if ( $folderitem->{'Styles'} ) { $styles = $folderitem->{'Styles'}; } - if ( $styles =~ /\bNON_ADVERTISED\b/ ) { next; } # no entry for non-advertised shortcuts - - if (( ! $folderitem->{'ismultilingual'} ) || (( $folderitem->{'ismultilingual'} ) && ( $folderitem->{'specificlanguage'} eq $onelanguage ))) - { - my $gid = $folderitem->{'gid'}; - my $app = $gid; - $app =~ s/gid_Folderitem_//; - $app = uc($app); - - my $name = $folderitem->{'Name'}; - my $placeholder = "PLACEHOLDER_FOLDERITEM_NAME_" . $app; - replace_in_template_file($templatefile, $placeholder, $name); - - my $tooltip = $folderitem->{'Tooltip'}; - $placeholder = "PLACEHOLDER_FOLDERITEM_TOOLTIP_" . $app; - replace_in_template_file($templatefile, $placeholder, $tooltip); - - my $executablegid = $folderitem->{'FileID'}; - my ($exefile) = grep {$_->{gid} eq $executablegid} @{$filesref}; - if (! defined $exefile) { - installer::exiter::exit_program("ERROR: Could not find file $executablegid in list of files!", "write_content_into_inf_file"); - } - - my $exefilename = $exefile->{'Name'}; - $placeholder = "PLACEHOLDER_FOLDERITEM_TARGET_" . $app; - replace_in_template_file($templatefile, $placeholder, $exefilename); - } - } - - # Third part: Windows registry entries - - # collecting all modules - - my $allmodules = collect_all_modules($registryitemsref); - - my @registryitems = (); - my $allsectionsstring = ""; - - for ( my $j = 0; $j <= $#{$allmodules}; $j++ ) - { - my $moduleid = ${$allmodules}[$j]; - - my $inffilemodule = $inffile->{'modules'}; - # inf files can be assigned to "gid_Module_Root_Files_2", but RegistryItems to "gid_Module_Root" - if ( $inffilemodule =~ /Module_Root/i ) { $inffilemodule = $installer::globals::rootmodulegid; } - - if ( ! ( $moduleid eq $inffilemodule )) { next; } - - my $shortmodulename = $moduleid; - $shortmodulename =~ s/gid_Module_//; - my $sectionname = "InstRegKeys." . $shortmodulename; - $allsectionsstring = $allsectionsstring . $sectionname . ","; - my $sectionheader = "\[" . $sectionname . "\]" . "\n"; - push(@registryitems, $sectionheader); - - for ( my $i = 0; $i <= $#{$registryitemsref}; $i++ ) - { - my $registryitem = ${$registryitemsref}[$i]; - - if ( ! ( $registryitem->{'ModuleID'} eq $moduleid )) { next; } - - if (( ! $registryitem->{'ismultilingual'} ) || (( $registryitem->{'ismultilingual'} ) && ( $registryitem->{'specificlanguage'} eq $onelanguage ))) - { - # Syntax: HKCR,".bau",,,"soffice.StarConfigFile.6" - - my $regroot = ""; - my $parentid = ""; - if ( $registryitem->{'ParentID'} ) { $parentid = $registryitem->{'ParentID'}; } - if ( $parentid eq "PREDEFINED_HKEY_CLASSES_ROOT" ) { $regroot = "HKCR"; } - if ( $parentid eq "PREDEFINED_HKEY_LOCAL_MACHINE" ) { $regroot = "HKCU"; } - - my $subkey = ""; - if ( $registryitem->{'Subkey'} ) { $subkey = $registryitem->{'Subkey'}; } - if ( $subkey ne "" ) { $subkey = "\"" . $subkey . "\""; } - - my $valueentryname = ""; - if ( $registryitem->{'Name'} ) { $valueentryname = $registryitem->{'Name'}; } - if ( $valueentryname ne "" ) { $valueentryname = "\"" . $valueentryname . "\""; } - - my $flag = ""; - - my $value = ""; - if ( $registryitem->{'Value'} ) { $value = $registryitem->{'Value'}; } - if ( $value =~ /\<progpath\>/ ) { $value =~ s/\\\"/\"\"/g; } # Quoting for INF is done by double "" - $value =~ s/\\\"/\"/g; # no more masquerading of '"' - $value =~ s/\<progpath\>/\%INSTALLLOCATION\%/g; - if ( $value ne "" ) { $value = "\"" . $value . "\""; } - - my $oneline = $regroot . "," . $subkey . "," . $valueentryname . "," . $flag . "," . $value . "\n"; - - push(@registryitems, $oneline); - } - } - - push(@registryitems, "\n"); # empty line after each section - } - - # replacing the $allsectionsstring - $allsectionsstring =~ s/\,\s*$//; - replace_in_template_file($templatefile, "ALLREGISTRYSECTIONSPLACEHOLDER", $allsectionsstring); - - # replacing the placeholder for all registry keys - replace_array_in_template_file($templatefile, "REGISTRYKEYSPLACEHOLDER", \@registryitems); - -} - -########################################################### -# Creating inf files for local user system integration -########################################################### - -sub create_inf_file -{ - my ($filesref, $registryitemsref, $folderref, $folderitemsref, $modulesref, $languagesarrayref, $languagestringref, $allvariableshashref) = @_; - - # collecting all files with flag INFFILE - - my $inf_files = collect_all_items_with_special_flag($filesref ,"INFFILE"); - - if ( $#{$inf_files} > -1 ) - { - # create new language specific inffile - installer::logger::include_header_into_logfile("Creating inf files:"); - - my $infdirname = "inffiles"; - my $infdir = installer::systemactions::create_directories($infdirname, $languagestringref); - - my $infoline = "Number of inf files: $#{$inf_files} + 1 \n"; - push( @installer::globals::logfileinfo, $infoline); - - # there are inffiles for all modules - - for ( my $i = 0; $i <= $#{$inf_files}; $i++ ) - { - my $inffile = ${$inf_files}[$i]; - my $inf_file_name = $inffile->{'Name'}; - - my $templatefilename = $inffile->{'sourcepath'}; - - if ( ! -f $templatefilename ) { installer::exiter::exit_program("ERROR: Could not find file $templatefilename !", "create_inf_file"); } - - # iterating over all languages - - for ( my $j = 0; $j <= $#{$languagesarrayref}; $j++ ) # iterating over all languages - { - my $firstlanguage = 0; - if ( $j == 0 ) { $firstlanguage = 1; } - - my $onelanguage = ${$languagesarrayref}[$j]; - - $infoline = "Templatefile: $inf_file_name, Language: $onelanguage \n"; - push( @installer::globals::logfileinfo, $infoline); - - my $templatefile = installer::files::read_file($templatefilename); - - my $linesbefore = $#{$templatefile}; - - write_content_into_inf_file($templatefile, $filesref, $registryitemsref, $folderref, $folderitemsref, $modulesref, $onelanguage, $inffile, $firstlanguage, $allvariableshashref); - - $infoline = "Lines change: From $linesbefore to $#{$templatefile}.\n"; - push( @installer::globals::logfileinfo, $infoline); - - # rename language specific inffile - my $language_inf_file_name = $inf_file_name; - my $windowslanguage = installer::windows::language::get_windows_language($onelanguage); - $language_inf_file_name =~ s/\.inf/_$windowslanguage\.inf/; - - my $sourcepath = $infdir . $installer::globals::separator . $language_inf_file_name; - installer::files::save_file($sourcepath, $templatefile); - - $infoline = "Saving file: $sourcepath\n"; - push( @installer::globals::logfileinfo, $infoline); - - # creating new file object - - my %languageinffile = (); - my $languageinifileref = \%languageinffile; - - if ( $j < $#{$languagesarrayref} ) { installer::converter::copy_item_object($inffile, $languageinifileref); } - else { $languageinifileref = $inffile; } - - $languageinifileref->{'Name'} = $language_inf_file_name; - $languageinifileref->{'sourcepath'} = $sourcepath; - # destination and gid also have to be adapted - $languageinifileref->{'gid'} = $languageinifileref->{'gid'} . "_" . $onelanguage; - my $destination = $languageinifileref->{'destination'}; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); - $destination = $destination . $language_inf_file_name; - $languageinifileref->{'destination'} = $destination; - - # add language specific inffile into filesarray - if ( $j < $#{$languagesarrayref} ) { push(@{$filesref}, $languageinifileref); } - } - } - } -} - -########################################################### # Selecting patch items ########################################################### |