diff options
author | Tim Retout <tim@retout.co.uk> | 2012-09-30 13:15:23 +0100 |
---|---|---|
committer | Tim Retout <tim@retout.co.uk> | 2012-09-30 16:50:54 +0100 |
commit | 665785c073f695922603854a9d2d5ecab4061ff0 (patch) | |
tree | 244f53d5db51196d527455f496d4af6c7b24e241 /solenv | |
parent | add sal and xml2cmp back to build.pl deps (diff) | |
download | core-665785c073f695922603854a9d2d5ecab4061ff0.tar.gz core-665785c073f695922603854a9d2d5ecab4061ff0.zip |
installer: Create new read_ziplist function.
Change-Id: Ie91376bf9c52238febdc15720bb7f4cd62ee2e08
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer.pm | 72 | ||||
-rw-r--r-- | solenv/bin/modules/installer/ziplist.pm | 73 |
2 files changed, 75 insertions, 70 deletions
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm index 54b64b098bb4..4c50d3b9e426 100644 --- a/solenv/bin/modules/installer.pm +++ b/solenv/bin/modules/installer.pm @@ -82,7 +82,7 @@ use installer::windows::strip; use installer::windows::update; use installer::windows::upgrade; use installer::worker; -use installer::ziplist; +use installer::ziplist qw(read_ziplist); our @EXPORT_OK = qw(main); @@ -163,75 +163,7 @@ sub run { # Analyzing the settings and variables in zip.lst ################################################### - installer::logger::globallog("zip list file: $installer::globals::ziplistname"); - - my $ziplistref = installer::files::read_file($installer::globals::ziplistname); - - installer::logger::print_message( "... analyzing $installer::globals::ziplistname ... \n" ); - - my ($productblockref, $parent) = installer::ziplist::getproductblock($ziplistref, $installer::globals::product, 1); # product block from zip.lst - - my ($settingsblockref, undef) = installer::ziplist::getproductblock($productblockref, "Settings", 0); # settings block from zip.lst - - $settingsblockref = installer::ziplist::analyze_settings_block($settingsblockref); # select data from settings block in zip.lst - - my $allsettingsarrayref = installer::ziplist::get_settings_from_ziplist($settingsblockref); - - my $allvariablesarrayref = installer::ziplist::get_variables_from_ziplist($settingsblockref); - - my ($globalproductblockref, undef) = installer::ziplist::getproductblock($ziplistref, $installer::globals::globalblock, 0); # global product block from zip.lst - - 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); - $allsettingsarrayref = - installer::converter::combine_arrays_from_references_first_win( - $allsettingsarrayref, $allparentsettingsarrayref) - if $#{$allparentsettingsarrayref} > -1; - $allvariablesarrayref = - installer::converter::combine_arrays_from_references_first_win( - $allvariablesarrayref, $allparentvariablesarrayref) - if $#{$allparentvariablesarrayref} > -1; - } - - if ( $#{$globalproductblockref} > -1 ) - { - my ($globalsettingsblockref, undef) = installer::ziplist::getproductblock($globalproductblockref, "Settings", 0); # settings block from zip.lst - - $globalsettingsblockref = installer::ziplist::analyze_settings_block($globalsettingsblockref); # select data from settings block in zip.lst - - my $allglobalsettingsarrayref = installer::ziplist::get_settings_from_ziplist($globalsettingsblockref); - - my $allglobalvariablesarrayref = installer::ziplist::get_variables_from_ziplist($globalsettingsblockref); - - if ( $#{$allglobalsettingsarrayref} > -1 ) { $allsettingsarrayref = installer::converter::combine_arrays_from_references_first_win($allsettingsarrayref, $allglobalsettingsarrayref); } - if ( $#{$allglobalvariablesarrayref} > -1 ) { $allvariablesarrayref = installer::converter::combine_arrays_from_references_first_win($allvariablesarrayref, $allglobalvariablesarrayref); } - } - - $allsettingsarrayref = installer::ziplist::remove_multiples_from_ziplist($allsettingsarrayref); # the settings from the zip.lst - - $allvariablesarrayref = installer::ziplist::remove_multiples_from_ziplist($allvariablesarrayref); - - installer::ziplist::replace_variables_in_ziplist_variables($allvariablesarrayref); - - my $allvariableshashref = installer::converter::convert_array_to_hash($allvariablesarrayref); # the variables from the zip.lst - - installer::ziplist::set_default_productversion_if_required($allvariableshashref); - - installer::ziplist::add_variables_to_allvariableshashref($allvariableshashref); - - installer::ziplist::overwrite_branding( $allvariableshashref ); - + my ($allsettingsarrayref, $allvariableshashref) = read_ziplist($installer::globals::ziplistname); ######################################################## # Check if this is simple packaging mechanism diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index 95b56389fd47..4a3e4767a0bd 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -27,14 +27,87 @@ package installer::ziplist; +use base 'Exporter'; + use File::Spec::Functions qw(rel2abs); +use installer::converter; use installer::exiter; +use installer::files; use installer::globals; use installer::logger; use installer::remover; use installer::systemactions; +our @EXPORT_OK = qw(read_ziplist); + +sub read_ziplist { + my $ziplistname = shift; + + installer::logger::globallog("zip list file: $ziplistname"); + + my $ziplistref = installer::files::read_file($ziplistname); + + installer::logger::print_message( "... analyzing $ziplistname ... \n" ); + + my ($productblockref, $parent) = getproductblock($ziplistref, $installer::globals::product, 1); # product block from zip.lst + + my ($settingsblockref, undef) = getproductblock($productblockref, "Settings", 0); # settings block from zip.lst + $settingsblockref = analyze_settings_block($settingsblockref); # select data from settings block in zip.lst + + my $allsettingsarrayref = get_settings_from_ziplist($settingsblockref); + my $allvariablesarrayref = get_variables_from_ziplist($settingsblockref); + + my ($globalproductblockref, undef) = getproductblock($ziplistref, $installer::globals::globalblock, 0); # global product block from zip.lst + + while (defined $parent) { + my $parentproductblockref; + ($parentproductblockref, $parent) = getproductblock($ziplistref, $parent, 1); + my ($parentsettingsblockref, undef) = getproductblock($parentproductblockref, "Settings", 0); + $parentsettingsblockref = analyze_settings_block($parentsettingsblockref); + my $allparentsettingsarrayref = get_settings_from_ziplist($parentsettingsblockref); + my $allparentvariablesarrayref = get_variables_from_ziplist($parentsettingsblockref); + $allsettingsarrayref = + installer::converter::combine_arrays_from_references_first_win( + $allsettingsarrayref, $allparentsettingsarrayref) + if $#{$allparentsettingsarrayref} > -1; + $allvariablesarrayref = + installer::converter::combine_arrays_from_references_first_win( + $allvariablesarrayref, $allparentvariablesarrayref) + if $#{$allparentvariablesarrayref} > -1; + } + + if ( @{$globalproductblockref} ) { + my ($globalsettingsblockref, undef) = getproductblock($globalproductblockref, "Settings", 0); # settings block from zip.lst + + $globalsettingsblockref = analyze_settings_block($globalsettingsblockref); # select data from settings block in zip.lst + + my $allglobalsettingsarrayref = get_settings_from_ziplist($globalsettingsblockref); + + my $allglobalvariablesarrayref = get_variables_from_ziplist($globalsettingsblockref); + + if ( @{$allglobalsettingsarrayref} ) { + $allsettingsarrayref = installer::converter::combine_arrays_from_references_first_win($allsettingsarrayref, $allglobalsettingsarrayref); + } + if ( @{$allglobalvariablesarrayref} ) { + $allvariablesarrayref = installer::converter::combine_arrays_from_references_first_win($allvariablesarrayref, $allglobalvariablesarrayref); + } + } + + $allsettingsarrayref = remove_multiples_from_ziplist($allsettingsarrayref); + $allvariablesarrayref = remove_multiples_from_ziplist($allvariablesarrayref); + + replace_variables_in_ziplist_variables($allvariablesarrayref); + + my $allvariableshashref = installer::converter::convert_array_to_hash($allvariablesarrayref); + + set_default_productversion_if_required($allvariableshashref); + add_variables_to_allvariableshashref($allvariableshashref); + overwrite_branding( $allvariableshashref ); + + return $allsettingsarrayref, $allvariableshashref; +} + ################################################# # Getting data from path file and zip list file ################################################# |