diff options
author | Tim Retout <tim@retout.co.uk> | 2012-02-17 22:00:53 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-02-18 09:40:55 +0000 |
commit | 6e07845a00bceaf66e95b97ea964b7868eff80c0 (patch) | |
tree | 8a66b3c629e47f889dc6d88aa7fcb19ca3c7f6cf /solenv/bin | |
parent | 94446db8dff61687ad6100b9fd03f2170be37919 (diff) |
Remove installer::existence::exists_in_array.
Diffstat (limited to 'solenv/bin')
19 files changed, 27 insertions, 49 deletions
diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index 47d137c841ae..a8233064b824 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -1920,7 +1920,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) my $onelanguage = ${$languagesarrayref}[$m]; my $is_rtl = 0; - if ( installer::existence::exists_in_array($onelanguage, \@installer::globals::rtllanguages) ) { $is_rtl = 1; } + if ( grep {$_ eq $onelanguage} @installer::globals::rtllanguages ) { $is_rtl = 1; } my $languageidtdir = $idtdirbase . $installer::globals::separator . $onelanguage; if ( -d $languageidtdir ) { installer::systemactions::remove_complete_directory($languageidtdir, 1); } diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm index 21f8f2be49d9..a81b0f640638 100644 --- a/solenv/bin/modules/installer/archivefiles.pm +++ b/solenv/bin/modules/installer/archivefiles.pm @@ -390,7 +390,7 @@ sub resolving_archive_flag if ( $select_files ) { - if ( ! installer::existence::exists_in_array($zipname,$selectlistfiles) ) + if ( ! grep {$_ eq $zipname} @{$selectlistfiles} ) { $infoline = "Removing from ARCHIVE file $onefilename: $zipname\n"; push( @installer::globals::logfileinfo, $infoline); @@ -409,7 +409,7 @@ sub resolving_archive_flag # Is this file listed in the Patchfile list? # $zipname (filename including path in zip file has to be listed in patchfile list - if ( ! installer::existence::exists_in_array($zipname,$patchlistfiles) ) + if ( ! grep {$_ eq $zipname} @{$patchlistfiles} ) { $newfile{'Styles'} =~ s/\bPATCH\b//; # removing the flag PATCH $newfile{'Styles'} =~ s/\,\s*\,/\,/; @@ -476,7 +476,7 @@ sub resolving_archive_flag for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ ) { - if ( ! installer::existence::exists_in_array(${$selectlistfiles}[$k],\@keptfiles) ) + if ( ! grep {$_ eq ${$selectlistfiles}[$k]} @keptfiles ) { push(@warningfiles, ${$selectlistfiles}[$k]); } @@ -514,7 +514,7 @@ sub resolving_archive_flag for ( my $k = 0; $k <= $#{$patchlistfiles}; $k++ ) { - if ( ! installer::existence::exists_in_array(${$patchlistfiles}[$k],\@keptpatchflags) ) + if ( ! grep {$_ eq ${$patchlistfiles}[$k]} @keptpatchflags ) { push(@warningfiles, ${$patchlistfiles}[$k]); } diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index b7299efa227f..6a91fb4c9634 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -1680,7 +1680,7 @@ sub set_tab_into_datafile push(@installer::globals::logfileinfo, $infoline); # collecting all new classes - if (! installer::existence::exists_in_array($onefile->{'SolarisClass'}, \@newclasses)) + if (! grep {$_ eq $onefile->{'SolarisClass'}} @newclasses) { push(@newclasses, $onefile->{'SolarisClass'}); } diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm index 0581efd9c5f7..134637219126 100644 --- a/solenv/bin/modules/installer/existence.pm +++ b/solenv/bin/modules/installer/existence.pm @@ -27,28 +27,6 @@ package installer::existence; -############################# -# Test of existence -############################# - -sub exists_in_array -{ - my ($searchstring, $arrayref) = @_; - - my $alreadyexists = 0; - - for ( my $i = 0; $i <= $#{$arrayref}; $i++ ) - { - if ( ${$arrayref}[$i] eq $searchstring) - { - $alreadyexists = 1; - last; - } - } - - return $alreadyexists; -} - ##################################################################### # Returning a specified file as base for the new # configuration file, defined by its "gid" diff --git a/solenv/bin/modules/installer/languages.pm b/solenv/bin/modules/installer/languages.pm index 82ac7d0a1345..b6bf0a11782a 100644 --- a/solenv/bin/modules/installer/languages.pm +++ b/solenv/bin/modules/installer/languages.pm @@ -98,7 +98,7 @@ sub all_elements_of_array1_in_array2 for ( my $i = 0; $i <= $#{$array1}; $i++ ) { - if (! installer::existence::exists_in_array(${$array1}[$i], $array2)) + if (! grep {$_ eq ${$array1}[$i]} @{$array2}) { $array2_contains_all_elements_of_array1 = 0; last; diff --git a/solenv/bin/modules/installer/profiles.pm b/solenv/bin/modules/installer/profiles.pm index 2b794ce98c9c..22e18e69344d 100644 --- a/solenv/bin/modules/installer/profiles.pm +++ b/solenv/bin/modules/installer/profiles.pm @@ -59,7 +59,7 @@ sub sorting_profile { my $section = $1; - if (!(installer::existence::exists_in_array($section, \@definedsections))) + if (! grep {$_ eq $section} @definedsections) { my $sectionline = $section . "\n"; push(@definedsections, $section); diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index 4614c3f9a28f..67db9ef0a9bc 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -776,7 +776,7 @@ sub collect_language_specific_names if (( $language ne "" ) && ( $language eq $specificlanguage )) { - if (! installer::existence::exists_in_array($oneitem->{'Name'}, \@installer::globals::languagenames )) + if (! grep {$_ eq $oneitem->{'Name'}} @installer::globals::languagenames ) { push(@installer::globals::languagenames, $oneitem->{'Name'}); } @@ -2627,7 +2627,7 @@ sub collect_all_parent_feature if ( $parentgid ne "" ) { - if (! installer::existence::exists_in_array($parentgid, \@allparents)) + if (! grep {$_ eq $parentgid} @allparents) { push(@allparents, $parentgid); } @@ -2668,7 +2668,7 @@ sub set_children_flag # is this gid a parent? - if ( installer::existence::exists_in_array($gid, $allparents) ) + if ( grep {$_ eq $gid} @{$allparents} ) { $onefeature->{'has_children'} = 1; } diff --git a/solenv/bin/modules/installer/strip.pm b/solenv/bin/modules/installer/strip.pm index a9541879d119..777b7739ac75 100644 --- a/solenv/bin/modules/installer/strip.pm +++ b/solenv/bin/modules/installer/strip.pm @@ -94,7 +94,7 @@ sub strip_libraries my $strippeddirbase = installer::systemactions::create_directories("stripped", $languagestringref); - if (! installer::existence::exists_in_array($strippeddirbase, \@installer::globals::removedirs)) + if (! grep {$_ eq $strippeddirbase} @installer::globals::removedirs) { push(@installer::globals::removedirs, $strippeddirbase); } diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index 559953ae5067..899ad2482ef7 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -1295,7 +1295,7 @@ sub find_new_content_in_directory if (( -f $completeentry ) || ( -d $completeentry )) { push(@allcontent, $completeentry); - if (! installer::existence::exists_in_array($completeentry, $oldcontent)) + if (! grep {$_ eq $completeentry} @{$oldcontent}) { push(@newcontent, $completeentry); } diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index da11997e5f83..7a230802508c 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -467,7 +467,7 @@ sub get_component_name_from_modulegid my $filemodules = $onefile->{'modules'}; my $filemodulesarrayref = installer::converter::convert_stringlist_into_array_without_newline(\$filemodules, ","); - if (installer::existence::exists_in_array($modulegid, $filemodulesarrayref)) + if (grep {$_ eq $modulegid} @{$filemodulesarrayref}) { $componentname = $onefile->{'componentname'}; last; diff --git a/solenv/bin/modules/installer/windows/feature.pm b/solenv/bin/modules/installer/windows/feature.pm index 92d8cfee8abe..dbc0efad203c 100644 --- a/solenv/bin/modules/installer/windows/feature.pm +++ b/solenv/bin/modules/installer/windows/feature.pm @@ -409,7 +409,7 @@ sub create_feature_table push(@featuretable, $oneline); # collecting all feature in global feature collector (so that properties can be set in property table) - if ( ! installer::existence::exists_in_array($feature{'feature'}, \@installer::globals::featurecollector) ) + if ( ! grep {$_ eq $feature{'feature'}} @installer::globals::featurecollector ) { push(@installer::globals::featurecollector, $feature{'feature'}); } diff --git a/solenv/bin/modules/installer/windows/featurecomponent.pm b/solenv/bin/modules/installer/windows/featurecomponent.pm index 8e9ebee84703..10792180cbd8 100644 --- a/solenv/bin/modules/installer/windows/featurecomponent.pm +++ b/solenv/bin/modules/installer/windows/featurecomponent.pm @@ -78,7 +78,7 @@ sub create_featurecomponent_table_from_files_collector # control of uniqueness - if (! installer::existence::exists_in_array($oneline, $featurecomponenttableref)) + if (! grep {$_ eq $oneline} @{$featurecomponenttableref}) { push(@{$featurecomponenttableref}, $oneline); } @@ -124,7 +124,7 @@ sub create_featurecomponent_table_from_registry_collector # control of uniqueness - if (! installer::existence::exists_in_array($oneline, $featurecomponenttableref)) + if (! grep {$_ eq $oneline} @{$featurecomponenttableref}) { push(@{$featurecomponenttableref}, $oneline); } diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm index ba9f7a8e6488..8312e56beefe 100644 --- a/solenv/bin/modules/installer/windows/registry.pm +++ b/solenv/bin/modules/installer/windows/registry.pm @@ -401,7 +401,7 @@ sub create_registry_table $registry{'Component_'} = get_registry_component($oneregistry, $allvariableshashref); # Collecting all components - if (!(installer::existence::exists_in_array($registry{'Component_'}, $allregistrycomponentsref))) + if (! grep {$_ eq $registry{'Component_'}} @{$allregistrycomponentsref}) { push(@{$allregistrycomponentsref}, $registry{'Component_'}); } diff --git a/solenv/bin/modules/installer/windows/removefile.pm b/solenv/bin/modules/installer/windows/removefile.pm index ec2a6142db71..ec12636ed224 100644 --- a/solenv/bin/modules/installer/windows/removefile.pm +++ b/solenv/bin/modules/installer/windows/removefile.pm @@ -122,7 +122,7 @@ sub create_removefile_table if ( $onelink->{'used'} == 0 ) { next; } - if ( installer::existence::exists_in_array($onelink->{'directory'}, \@directorycollector)) { next; } + next if grep {$_ eq $onelink->{'directory'}} @directorycollector; push(@directorycollector, $onelink->{'directory'}); diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm index 6c73f773cb24..cef50205de6b 100644 --- a/solenv/bin/modules/installer/windows/shortcut.pm +++ b/solenv/bin/modules/installer/windows/shortcut.pm @@ -516,7 +516,7 @@ sub get_folderitem_icon my $sourcepath = $onefile->{'sourcepath'}; - if (! installer::existence::exists_in_array($sourcepath, $iconfilecollector)) + if (! grep {$_ eq $sourcepath} @{$iconfilecollector}) { push(@{$iconfilecollector}, $sourcepath); } @@ -674,7 +674,7 @@ sub create_shortcut_table if ($$sourcepathref eq "") { installer::exiter::exit_program("ERROR: Could not find $sofficefile as icon!", "create_shortcut_table"); } - if (! installer::existence::exists_in_array($$sourcepathref, $iconfilecollector)) + if (! grep {$_ eq $$sourcepathref} @{$iconfilecollector}) { unshift(@{$iconfilecollector}, $$sourcepathref); $installer::globals::sofficeiconadded = 1; diff --git a/solenv/bin/modules/installer/windows/strip.pm b/solenv/bin/modules/installer/windows/strip.pm index 79b1046c1e8f..6f9f98392211 100644 --- a/solenv/bin/modules/installer/windows/strip.pm +++ b/solenv/bin/modules/installer/windows/strip.pm @@ -97,7 +97,7 @@ sub strip_binaries my $strippeddirbase = installer::systemactions::create_directories("stripped", $languagestringref); - if (! installer::existence::exists_in_array($strippeddirbase, \@installer::globals::removedirs)) + if (! grep {$_ eq $strippeddirbase} @installer::globals::removedirs) { push(@installer::globals::removedirs, $strippeddirbase); } diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 6f6801a525fe..be24ff7e776e 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -636,7 +636,7 @@ sub collect_all_modules $registryitem = ${$registryitemsref}[$i]; my $module = $registryitem->{'ModuleID'}; - if ( ! installer::existence::exists_in_array($module, \@allmodules) ) + if ( ! grep {$_ eq $module} @allmodules ) { push(@allmodules, $module); } diff --git a/solenv/bin/modules/installer/xpdinstaller.pm b/solenv/bin/modules/installer/xpdinstaller.pm index ac38b6489657..26059a77018b 100644 --- a/solenv/bin/modules/installer/xpdinstaller.pm +++ b/solenv/bin/modules/installer/xpdinstaller.pm @@ -1602,7 +1602,7 @@ sub create_xpd_file { my $create_missing_parent = is_empty_parent($parentgid, $allpackages); - if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) + if ($create_missing_parent && ( ! grep {$_ eq $parentgid} @installer::globals::createdxpdfiles )) { $grandpagid = create_emptyparents_xpd_file($parentgid, $modulesarrayref, $xpddir); } @@ -1612,7 +1612,7 @@ sub create_xpd_file { my $create_missing_parent = is_empty_parent($grandpagid, $allpackages); - if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($grandpagid, \@installer::globals::createdxpdfiles) )) + if ($create_missing_parent && ( ! grep {$_ eq $grandpagid} @installer::globals::createdxpdfiles )) { create_emptyparents_xpd_file($grandpagid, $modulesarrayref, $xpddir); } @@ -1657,7 +1657,7 @@ sub create_xpd_file_for_childproject { my $create_missing_parent = 1; # -> Always missing parent by child projects! # Parent is now created, if it was not created before. Attention: Parent module must not come later. - if (( $create_missing_parent ) && ( ! installer::existence::exists_in_array($parentgid, \@installer::globals::createdxpdfiles) )) + if ($create_missing_parent && ( ! grep {$_ eq $parentgid} @installer::globals::createdxpdfiles )) { create_emptyparents_xpd_file($parentgid, $modulesarrayref, $installer::globals::xpddir); } diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index 3219e71284e1..d5137414502c 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -383,7 +383,7 @@ sub remove_multiples_from_ziplist $itemname = $1; } - if (! installer::existence::exists_in_array($itemname, \@itemarray)) + if (! grep {$_ eq $itemname} @itemarray) { push(@itemarray, $itemname); } |