diff options
author | Tim Retout <tim@retout.co.uk> | 2012-08-19 02:41:45 +0100 |
---|---|---|
committer | Tim Retout <tim@retout.co.uk> | 2012-08-19 02:41:45 +0100 |
commit | 248ea1924e90ee22f55852c42f4e5cfea342737f (patch) | |
tree | 542e06bb3274ee09f72debf17242401d64487a54 /solenv | |
parent | c6189b43f3103300dd03375a4bd6a5589708d8c9 (diff) |
Replace all uses of convert_stringlist_into_array_without_newline
Change-Id: I7c835e6202f21f250045f2e6517ac75847f8eb03
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer/archivefiles.pm | 5 | ||||
-rw-r--r-- | solenv/bin/modules/installer/control.pm | 13 | ||||
-rw-r--r-- | solenv/bin/modules/installer/converter.pm | 12 | ||||
-rw-r--r-- | solenv/bin/modules/installer/windows/component.pm | 19 | ||||
-rw-r--r-- | solenv/bin/modules/installer/windows/directory.pm | 30 | ||||
-rw-r--r-- | solenv/bin/modules/installer/worker.pm | 8 |
6 files changed, 32 insertions, 55 deletions
diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm index 0d75b671a213..066aed097fbf 100644 --- a/solenv/bin/modules/installer/archivefiles.pm +++ b/solenv/bin/modules/installer/archivefiles.pm @@ -28,7 +28,6 @@ package installer::archivefiles; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); -use installer::converter; use installer::exiter; use installer::files; use installer::globals; @@ -87,9 +86,9 @@ sub get_patch_file_list $patchfilestring =~ s/^\s*\///; $patchfilestring =~ s/^\s*\\//; - my $patchfilesarray = installer::converter::convert_stringlist_into_array_without_newline(\$patchfilestring, ","); + my @patchfilesarray = split /,\s*/, $patchfilestring; - return $patchfilesarray; + return \@patchfilesarray; } ################################################################# diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index 57659a1f268c..c097fb1f196a 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -91,15 +91,12 @@ sub check_system_path my $local_pathseparator = $installer::globals::pathseparator; if( $^O =~ /cygwin/i ) - { # When using cygwin's perl the PATH variable is POSIX style and ... - my $temparrayref = installer::converter::convert_stringlist_into_array_without_newline(\$pathvariable, $local_pathseparator); - foreach $i (0..$#$temparrayref) { - $$temparrayref[$i] = qx{cygpath -m "$$temparrayref[$i]"}; - chomp($$temparrayref[$i]); - } + { + # When using cygwin's perl the PATH variable is POSIX style and # has to be converted to DOS style for further use. - $local_pathseparator = ';'; - $pathvariable = join($local_pathseparator, @$temparrayref); + $pathvariable = join ';', + map { $dir = qx{cygpath -m "$_"}; chomp($dir); $dir } + split /\Q$local_pathseparator\E\s*/, $pathvariable; } my $patharrayref = installer::converter::convert_stringlist_into_array(\$pathvariable, $local_pathseparator); diff --git a/solenv/bin/modules/installer/converter.pm b/solenv/bin/modules/installer/converter.pm index a80426e4ea0c..7c9598ce8526 100644 --- a/solenv/bin/modules/installer/converter.pm +++ b/solenv/bin/modules/installer/converter.pm @@ -65,18 +65,6 @@ sub convert_stringlist_into_array ############################################################################# # Converting a string list with separator $listseparator -# into an array -############################################################################# - -sub convert_stringlist_into_array_without_newline -{ - my ( $includestringref, $listseparator ) = @_; - - return [split /\Q$listseparator\E\s*/, ${$includestringref}]; -} - -############################################################################# -# Converting a string list with separator $listseparator # into a hash with values 1. ############################################################################# diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index cd872091dc41..555c99cdb0f4 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -27,7 +27,6 @@ package installer::windows::component; -use installer::converter; use installer::exiter; use installer::files; use installer::globals; @@ -460,20 +459,16 @@ sub get_component_name_from_modulegid my $componentname = ""; - for ( my $i = 0; $i <= $#{$filesref}; $i++ ) + for my $file ( @{$filesref} ) { - my $onefile = ${$filesref}[$i]; + next if ( ! $file->{'modules'} ); - if ( $onefile->{'modules'} ) - { - my $filemodules = $onefile->{'modules'}; - my $filemodulesarrayref = installer::converter::convert_stringlist_into_array_without_newline(\$filemodules, ","); + my @filemodules = split /,\s*/, $file->{'modules'}; - if (grep {$_ eq $modulegid} @{$filemodulesarrayref}) - { - $componentname = $onefile->{'componentname'}; - last; - } + if (grep {$_ eq $modulegid} @filemodules) + { + $componentname = $file->{'componentname'}; + last; } } diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 606a2a03faec..7e9a9c077ac8 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -86,35 +86,37 @@ sub make_short_dir_version my ($longstring, $length, $displayname) = @_; my $shortstring = ""; - my $infoline = ""; - my $savestring = $longstring; - # Splitting the string at each "underline" and allowing only $length characters per directory name. + # Splitting the string at each "underline" and allowing only + # $length characters per directory name. # Checking also uniqueness and length. - my $stringarray = installer::converter::convert_stringlist_into_array_without_newline(\$longstring, "_"); - - foreach my $onestring ( @{$stringarray} ) + for my $onestring ( split /_\s*/, $longstring ) { my $partstring = ""; if ( $onestring =~ /\-/ ) { - my $localstringarray = installer::converter::convert_stringlist_into_array_without_newline(\$onestring, "-"); - foreach my $onelocalstring ( @{$localstringarray} ) + for my $onelocalstring ( split /-\s*/, $onestring ) { - if ( length($onelocalstring) > $length ) { $onelocalstring = substr($onelocalstring, 0, $length); } - $partstring = $partstring . "-" . $onelocalstring; + if ( length($onelocalstring) > $length ) { + $onelocalstring = substr($onelocalstring, 0, $length); + } + $partstring .= "-" . $onelocalstring; } $partstring =~ s/^\s*\-//; } else { - if ( length($onestring) > $length ) { $partstring = substr($onestring, 0, $length); } - else { $partstring = $onestring; } + if ( length($onestring) > $length ) { + $partstring = substr($onestring, 0, $length); + } + else { + $partstring = $onestring; + } } - $shortstring = $shortstring . "_" . $partstring; + $shortstring .= "_" . $partstring; } $shortstring =~ s/^\s*\_//; @@ -122,7 +124,7 @@ sub make_short_dir_version if ( length($shortstring) > 72 ) { my $shortlength = length($shortstring); - $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n"; + my $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n"; push(@installer::globals::logfileinfo, $infoline); } diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index eb87bee544c0..8ae8e62b1d9a 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -1503,14 +1503,10 @@ sub add_variables_from_inc_to_hashref my ($allvariables, $includepatharrayref) = @_; my $infoline = ""; - my $includefilelist = ""; - if ( $allvariables->{'ADD_INCLUDE_FILES'} ) { $includefilelist = $allvariables->{'ADD_INCLUDE_FILES'}; } + my $includefilelist = $allvariables->{'ADD_INCLUDE_FILES'} || ""; - my $includefiles = installer::converter::convert_stringlist_into_array_without_newline(\$includefilelist, ","); - - for ( my $i = 0; $i <= $#{$includefiles}; $i++ ) + for my $includefilename (split /,\s*/, $includefilelist) { - my $includefilename = ${$includefiles}[$i]; $includefilename =~ s/^\s*//; $includefilename =~ s/\s*$//; $includefilenameref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$includefilename, $includepatharrayref, 1); |