[Libreoffice-commits] .: solenv/bin
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Aug 18 19:07:16 PDT 2012
solenv/bin/modules/installer/archivefiles.pm | 5 +--
solenv/bin/modules/installer/control.pm | 13 +++------
solenv/bin/modules/installer/converter.pm | 12 --------
solenv/bin/modules/installer/windows/component.pm | 19 +++++--------
solenv/bin/modules/installer/windows/directory.pm | 30 +++++++++++-----------
solenv/bin/modules/installer/worker.pm | 8 +----
6 files changed, 32 insertions(+), 55 deletions(-)
New commits:
commit 248ea1924e90ee22f55852c42f4e5cfea342737f
Author: Tim Retout <tim at retout.co.uk>
Date: Sun Aug 19 02:41:45 2012 +0100
Replace all uses of convert_stringlist_into_array_without_newline
Change-Id: I7c835e6202f21f250045f2e6517ac75847f8eb03
diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm
index 0d75b67..066aed0 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 57659a1..c097fb1 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 a80426e..7c9598c 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 cd87209..555c99c 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 606a2a0..7e9a9c0 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 eb87bee..8ae8e62 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);
More information about the Libreoffice-commits
mailing list