From 26f3aaa28c03baa898030cb894f9a3ad7f1cb10d Mon Sep 17 00:00:00 2001 From: Tim Retout Date: Fri, 17 Feb 2012 23:01:27 +0000 Subject: Remove installer::existence::get_specified_file. --- solenv/bin/modules/installer/existence.pm | 36 ---------------------- solenv/bin/modules/installer/profiles.pm | 5 ++- .../bin/modules/installer/windows/createfolder.pm | 10 ++++-- solenv/bin/modules/installer/windows/file.pm | 6 +++- solenv/bin/modules/installer/windows/inifile.pm | 6 +++- solenv/bin/modules/installer/worker.pm | 6 +++- 6 files changed, 26 insertions(+), 43 deletions(-) (limited to 'solenv/bin') diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm index 95ba40dcfa66..cb9ab1d156b4 100644 --- a/solenv/bin/modules/installer/existence.pm +++ b/solenv/bin/modules/installer/existence.pm @@ -27,40 +27,4 @@ package installer::existence; -##################################################################### -# Returning a specified file as base for the new -# configuration file, defined by its "gid" -##################################################################### - -sub get_specified_file -{ - my ($filesarrayref, $searchgid) = @_; - - my $foundfile = 0; - my $onefile; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - $onefile = ${$filesarrayref}[$i]; - my $filegid = $onefile->{'gid'}; - - if ( $filegid eq $searchgid ) - { - $foundfile = 1; - last; - } - } - - my $errorline = "ERROR: Could not find file $searchgid in list of files!"; - - if ( $installer::globals::patch) { $errorline = "ERROR: Could not find file $searchgid in list of files! intro.bmp must be part of every patch. Please assign the flag PATCH in scp2 project."; } - - if (!($foundfile)) - { - installer::exiter::exit_program($errorline, "get_specified_file"); - } - - return $onefile; -} - 1; diff --git a/solenv/bin/modules/installer/profiles.pm b/solenv/bin/modules/installer/profiles.pm index 22e18e69344d..156796e4dbf2 100644 --- a/solenv/bin/modules/installer/profiles.pm +++ b/solenv/bin/modules/installer/profiles.pm @@ -97,7 +97,10 @@ sub add_profile_into_filelist my $vclgid = "gid_File_Lib_Vcl"; if ( $allvariables->{'GLOBALFILEGID'} ) { $vclgid = $allvariables->{'GLOBALFILEGID'}; } - my $vclfile = installer::existence::get_specified_file($filesarrayref, $vclgid); + my ($vclfile) = grep {$_->{gid} eq $vclgid} @{$filesarrayref}; + if (! defined $vclfile) { + installer::exiter::exit_program("ERROR: Could not find file $vclgid in list of files!", "add_profile_into_filelist"); + } # copying all base data installer::converter::copy_item_object($vclfile, \%profile); diff --git a/solenv/bin/modules/installer/windows/createfolder.pm b/solenv/bin/modules/installer/windows/createfolder.pm index cc3d87e47bb7..ab1c4f7e7721 100644 --- a/solenv/bin/modules/installer/windows/createfolder.pm +++ b/solenv/bin/modules/installer/windows/createfolder.pm @@ -94,10 +94,14 @@ sub get_createfolder_component my $globalfilegid = $allvariableshashref->{'GLOBALFILEGID'}; if ( $installer::globals::patch ) { $globalfilegid = $allvariableshashref->{'GLOBALPATCHFILEGID'}; } - my $onefile = ""; + my $onefile; if ( $installer::globals::languagepack ) { $onefile = get_languagepack_file($filesref, $onedir); } - elsif ( $installer::globals::helppack ) { $onefile = installer::existence::get_specified_file($filesref, 'gid_File_Help_Common_Zip'); } - else { $onefile = installer::existence::get_specified_file($filesref, $globalfilegid); } + elsif ( $installer::globals::helppack ) { ($onefile) = grep {$_->{gid} eq 'gid_File_Help_Common_Zip'} @{$filesref} } + else { ($onefile) = grep {$_->{gid} eq $globalfilegid} @{$filesref} } + + if (! defined $onefile) { + installer::exiter::exit_program("ERROR: Could not find file!", "get_createfolder_component"); + } return $onefile->{'componentname'}; } diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index 044a1af01c4b..a0dee6c36e9d 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -358,7 +358,11 @@ sub get_component_from_assigned_file { my ($gid, $filesref) = @_; - my $onefile = installer::existence::get_specified_file($filesref, $gid); + my ($onefile) = grep {$_->{gid} eq $gid} @{$filesref}; + if (! defined $onefile) { + installer::exiter::exit_program("ERROR: Could not find file $gid in list of files!", "get_component_from_assigned_file"); + } + my $componentname = ""; if ( $onefile->{'componentname'} ) { $componentname = $onefile->{'componentname'}; } else { installer::exiter::exit_program("ERROR: No component defined for file: $gid", "get_component_from_assigned_file"); } diff --git a/solenv/bin/modules/installer/windows/inifile.pm b/solenv/bin/modules/installer/windows/inifile.pm index de279da8d48b..9afe6cdfe3f4 100644 --- a/solenv/bin/modules/installer/windows/inifile.pm +++ b/solenv/bin/modules/installer/windows/inifile.pm @@ -28,6 +28,7 @@ package installer::windows::inifile; use installer::existence; +use installer::exiter; use installer::files; use installer::globals; use installer::windows::idtglobal; @@ -40,7 +41,10 @@ sub get_profile_for_profileitem { my ($profileid, $filesref) = @_; - my $profile = installer::existence::get_specified_file($filesref, $profileid); + my ($profile) = grep {$_->{gid} eq $profileid} @{$filesref}; + if (! defined $profile) { + installer::exiter::exit_program("ERROR: Could not find file $profileid in list of files!", "get_profile_for_profileitem"); + } return $profile; } diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 6592d08ef2ea..13089d521f9a 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -718,7 +718,11 @@ sub write_content_into_inf_file replace_in_template_file($templatefile, $placeholder, $tooltip); my $executablegid = $folderitem->{'FileID'}; - my $exefile = installer::existence::get_specified_file($filesref, $executablegid); + 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); -- cgit