This patch series removes several versions of Perl modules named
<foo>::existence - the functions can be reimplemented with the "grep"
keyword.
The most arguably useful functions were get_specified_file{,by_name}
from installer::existence. These encapsulated a small amount of
knowledge of a consistent hashref format that represents a file in the
installer code (i.e. a known hash key). However, each of the last
three patches are still net code removals, and I suspect that getting
the grep inlined into the caller functions might help with refactoring
later.
Some error messages may change in patch 9, but the error message logic
in get_specified_file_by_name was not clear to me, (even checking the
context of CWS nativefixer6 that introduced it):
if ( $installer::globals::patch) {
$errorline .= "intro.bmp must be part of every patch [...]
If there's a reason to preserve that, I can revise those bits.
Oh, and there should be two new unit tests in there, too - not
complete code coverage by any means, but they were useful during
development to prove that I wasn't breaking the tested functions.
Now that I've done such a huge patch series, I wonder if there was a
better way to approach this to make it easier to review... :(
Kind regards,
--
Tim Retout <tim@retout.co.uk>
From 23597b8d0000a577dafff370ea3c9ca90a80ebd2 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 18:30:09 +0000
Subject: [PATCH 01/10] Remove unused par2script::existence.
---
solenv/bin/modules/par2script/existence.pm | 74 ----------------------------
solenv/bin/modules/par2script/work.pm | 1 -
2 files changed, 0 insertions(+), 75 deletions(-)
delete mode 100644 solenv/bin/modules/par2script/existence.pm
diff --git a/solenv/bin/modules/par2script/existence.pm b/solenv/bin/modules/par2script/existence.pm
deleted file mode 100644
index 08fb8ed..0000000
--- a/solenv/bin/modules/par2script/existence.pm
+++ /dev/null
@@ -1,74 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-
-package par2script::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;
-}
-
-sub exists_in_array_of_hashes
-{
- my ($searchkey, $searchvalue, $arrayref) = @_;
-
- my $hashref;
- my $valueexists = 0;
-
- for ( my $i = 0; $i <= $#{$arrayref}; $i++ )
- {
- $hashref = ${$arrayref}[$i];
-
- if ( $hashref->{$searchkey} eq $searchvalue )
- {
- $valueexists = 1;
- last;
- }
- }
-
- return $valueexists;
-}
-
-1;
diff --git a/solenv/bin/modules/par2script/work.pm b/solenv/bin/modules/par2script/work.pm
index 10dd1ea..9fc2aec 100644
--- a/solenv/bin/modules/par2script/work.pm
+++ b/solenv/bin/modules/par2script/work.pm
@@ -28,7 +28,6 @@
package par2script::work;
-use par2script::existence;
use par2script::globals;
use par2script::remover;
--
1.7.8.3
From 24c1db60a3388a3d6da6ca248566509d4cd76af3 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 18:31:33 +0000
Subject: [PATCH 02/10] Remove unused pre2par::existence.
---
solenv/bin/modules/pre2par/existence.pm | 74 -------------------------------
solenv/bin/modules/pre2par/language.pm | 1 -
2 files changed, 0 insertions(+), 75 deletions(-)
delete mode 100644 solenv/bin/modules/pre2par/existence.pm
diff --git a/solenv/bin/modules/pre2par/existence.pm b/solenv/bin/modules/pre2par/existence.pm
deleted file mode 100644
index 1775f1d..0000000
--- a/solenv/bin/modules/pre2par/existence.pm
+++ /dev/null
@@ -1,74 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-
-package pre2par::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;
-}
-
-sub exists_in_array_of_hashes
-{
- my ($searchkey, $searchvalue, $arrayref) = @_;
-
- my $hashref;
- my $valueexists = 0;
-
- for ( my $i = 0; $i <= $#{$arrayref}; $i++ )
- {
- $hashref = ${$arrayref}[$i];
-
- if ( $hashref->{$searchkey} eq $searchvalue )
- {
- $valueexists = 1;
- last;
- }
- }
-
- return $valueexists;
-}
-
-1;
diff --git a/solenv/bin/modules/pre2par/language.pm b/solenv/bin/modules/pre2par/language.pm
index a6025e4..13718af 100644
--- a/solenv/bin/modules/pre2par/language.pm
+++ b/solenv/bin/modules/pre2par/language.pm
@@ -28,7 +28,6 @@
package pre2par::language;
use strict;
-use pre2par::existence;
##############################################################
# Returning a specific language string from the block
--
1.7.8.3
From f21e1a7b1c480d1717ba1dd9af2c31cc7cca5ce8 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 20:17:31 +0000
Subject: [PATCH 03/10] Use Exporter in packager::work and add unit test.
---
solenv/bin/modules/packager/work.pm | 8 ++++
solenv/bin/modules/t/packager-work.t | 62 ++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)
create mode 100644 solenv/bin/modules/t/packager-work.t
diff --git a/solenv/bin/modules/packager/work.pm b/solenv/bin/modules/packager/work.pm
index e18b6fb..2481834 100644
--- a/solenv/bin/modules/packager/work.pm
+++ b/solenv/bin/modules/packager/work.pm
@@ -28,11 +28,19 @@
package packager::work;
+use base 'Exporter';
+
use packager::exiter;
use packager::existence;
use packager::files;
use packager::globals;
+our @EXPORT_OK = qw(
+ set_global_variable
+ create_package_todos
+ execute_system_calls
+);
+
###########################################
# Setting global variables
###########################################
diff --git a/solenv/bin/modules/t/packager-work.t b/solenv/bin/modules/t/packager-work.t
new file mode 100644
index 0000000..af1fe02
--- /dev/null
+++ b/solenv/bin/modules/t/packager-work.t
@@ -0,0 +1,62 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# [ Copyright (C) 2012 Tim Retout <tim@retout.co.uk> (initial developer) ]
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib '.';
+
+BEGIN {
+ use_ok('packager::work', qw(
+ set_global_variable
+ create_package_todos
+ execute_system_calls
+ ));
+}
+
+$packager::globals::compiler = 'gcc';
+@packager::globals::logfileinfo = ();
+
+my $packagelist = <<'END';
+ # Comment
+ some_product gcc,gcc3.3 en_US,en_GB|fr_FR some_target
+ other_thing x y z
+END
+
+my @packagelist = split "\n", $packagelist;
+
+my $targets = create_package_todos( \@packagelist );
+
+is_deeply(\@packager::globals::logfileinfo,
+ ["some_target_en_US_en_GB\n",
+ "some_target_fr_FR\n"]);
+
+is_deeply($targets,
+ ["some_target_en_US_en_GB",
+ "some_target_fr_FR"]);
+
+done_testing();
--
1.7.8.3
From d6df47909af747f72addebc2d40c355b24537aa7 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 20:23:18 +0000
Subject: [PATCH 04/10] Remove packager::existence, and clean up
packager::work.
---
solenv/bin/modules/packager/existence.pm | 52 -------------------
solenv/bin/modules/packager/work.pm | 80 ++++++-----------------------
2 files changed, 17 insertions(+), 115 deletions(-)
delete mode 100644 solenv/bin/modules/packager/existence.pm
diff --git a/solenv/bin/modules/packager/existence.pm b/solenv/bin/modules/packager/existence.pm
deleted file mode 100644
index 81f1339..0000000
--- a/solenv/bin/modules/packager/existence.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-package packager::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;
-}
-
-1;
diff --git a/solenv/bin/modules/packager/work.pm b/solenv/bin/modules/packager/work.pm
index 2481834..cd5a7fc 100644
--- a/solenv/bin/modules/packager/work.pm
+++ b/solenv/bin/modules/packager/work.pm
@@ -28,11 +28,12 @@
package packager::work;
+use strict;
+use warnings;
+
use base 'Exporter';
use packager::exiter;
-use packager::existence;
-use packager::files;
use packager::globals;
our @EXPORT_OK = qw(
@@ -54,31 +55,6 @@ sub set_global_variable
$packager::globals::compiler = $compiler;
}
-#############################################################################
-# Converting a string list with separator $listseparator
-# into an array
-#############################################################################
-
-sub convert_stringlist_into_array
-{
- my ( $includestringref, $listseparator ) = @_;
-
- my @newarray = ();
- my $first;
- my $last = ${$includestringref};
-
- while ( $last =~ /^\s*(.+?)\Q$listseparator\E(.+)\s*$/) # "$" for minimal matching
- {
- $first = $1;
- $last = $2;
- push(@newarray, "$first");
- }
-
- push(@newarray, "$last");
-
- return \@newarray;
-}
-
###########################################
# Generating a list of package calls
# corresponding to the package list
@@ -90,51 +66,29 @@ sub create_package_todos
my @targets = (); # only used, if the build server is not used
- for ( my $i = 0; $i <= $#{$packagelist}; $i++ )
- {
- my $line = ${$packagelist}[$i];
-
- if ( $line =~ /^\s*\#/ ) { next; } # comment line
-
- if ( $line =~ /^\s*(\w+?)\s+(\S+?)\s+(\S+?)\s+(\w+?)\s*$/ )
- {
- my $product = $1;
- my $compilerlist = $2;
- my $languagelist = $3;
- my $target = $4;
+ for my $line ( @{$packagelist} ) {
+ next if ($line =~ /^\s*\#/); # comment line
- $product =~ s/\s//g;
- $compilerlist =~ s/\s//g;
- $languagelist =~ s/\s//g;
- $target =~ s/\s//g;
+ my ($product, $compilerlist, $languagelist, $target) =
+ ($line =~ /^\s*(\w+?)\s+(\S+?)\s+(\S+?)\s+(\w+?)\s*$/);
- my $compilers = convert_stringlist_into_array(\$compilerlist, ",");
+ my @compilers = split ',', $compilerlist;
- # is the compiler of this "build" part of the compiler list in pack.lst ?
+ # is the compiler of this "build" part of the compiler list in pack.lst ?
- if ( packager::existence::exists_in_array($packager::globals::compiler, $compilers) )
- {
- # products are separated in pack.lst by "|"
+ next unless grep { $_ eq $packager::globals::compiler } @compilers;
- my $languagesets = convert_stringlist_into_array(\$languagelist, "\|");
+ # products are separated in pack.lst by "|"
+ # now all information is available to create the targets for the systemcalls
+ for my $languagestring (split '\|', $languagelist) {
+ $languagestring =~ s/,/_/g; # comma in pack.lst becomes "_" in dmake command
- # now all information is available to create the targets for the systemcalls
-
- for ( my $j = 0; $j <= $#{$languagesets}; $j++ )
- {
- my $languagestring = ${$languagesets}[$j];
- $languagestring =~ s/\,/\_/g; # comma in pack.lst becomes "_" in dmake
command
-
- my $target = $target . "_" . $languagestring;
- push(@targets, $target);
-
- my $insertline = $target . "\n";
- push( @packager::globals::logfileinfo, $insertline);
- }
- }
+ push @targets, $target . '_' . $languagestring;
}
}
+ push @packager::globals::logfileinfo, map { $_ . "\n" } @targets;
+
return \@targets;
}
--
1.7.8.3
From 7d9f893a1285438706e2599a877792e492e650d7 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 20:59:20 +0000
Subject: [PATCH 05/10] Use Exporter in installer::setupscript and add unit
test.
---
solenv/bin/modules/installer/setupscript.pm | 16 ++++++
solenv/bin/modules/t/installer-setupscript.t | 76 ++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 0 deletions(-)
create mode 100644 solenv/bin/modules/t/installer-setupscript.t
diff --git a/solenv/bin/modules/installer/setupscript.pm
b/solenv/bin/modules/installer/setupscript.pm
index 7d590c5..cbd2cbd 100644
--- a/solenv/bin/modules/installer/setupscript.pm
+++ b/solenv/bin/modules/installer/setupscript.pm
@@ -27,6 +27,8 @@
package installer::setupscript;
+use base 'Exporter';
+
use installer::existence;
use installer::exiter;
use installer::globals;
@@ -35,6 +37,20 @@ use installer::remover;
use installer::scriptitems;
use installer::ziplist;
+our @EXPORT_OK = qw(
+ add_forced_properties
+ add_installationobject_to_variables
+ add_lowercase_productname_setupscriptvariable
+ add_predefined_folder
+ get_all_items_from_script
+ get_all_scriptvariables_from_installation_object
+ prepare_non_advertised_files
+ replace_all_setupscriptvariables_in_script
+ replace_preset_properties
+ resolve_lowercase_productname_setupscriptvariable
+ set_setupscript_name
+);
+
#######################################################
# Set setup script name, if not defined as parameter
#######################################################
diff --git a/solenv/bin/modules/t/installer-setupscript.t
b/solenv/bin/modules/t/installer-setupscript.t
new file mode 100644
index 0000000..1320d7f
--- /dev/null
+++ b/solenv/bin/modules/t/installer-setupscript.t
@@ -0,0 +1,76 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# [ Copyright (C) 2012 Tim Retout <tim@retout.co.uk> (initial developer) ]
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib '.';
+
+BEGIN {
+ use_ok('installer::setupscript', qw(
+ add_forced_properties
+ add_installationobject_to_variables
+ add_lowercase_productname_setupscriptvariable
+ add_predefined_folder
+ get_all_items_from_script
+ get_all_scriptvariables_from_installation_object
+ prepare_non_advertised_files
+ replace_all_setupscriptvariables_in_script
+ replace_preset_properties
+ resolve_lowercase_productname_setupscriptvariable
+ set_setupscript_name
+ ));
+}
+
+my @folders = (
+ { gid => '123' },
+ { gid => 'PREDEFINED_FOO' },
+ { gid => 'PREDEFINED_BAR' },
+);
+
+my @folderitems = (
+ { FolderID => 'PREDEFINED_AUTOSTART' },
+ { FolderID => 'PREDEFINED_BAR' },
+ { FolderID => '456' },
+);
+
+my @expected_folders = (
+ { gid => '123' },
+ { gid => 'PREDEFINED_FOO' },
+ { gid => 'PREDEFINED_BAR' },
+ {
+ ismultilingual => 0,
+ Name => "",
+ gid => 'PREDEFINED_AUTOSTART'
+ },
+);
+
+add_predefined_folder(\@folderitems, \@folders);
+
+is_deeply(\@folders, \@expected_folders);
+
+done_testing();
--
1.7.8.3
From 4aea9427f878a8f42b1609a0e4676055106a3db5 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 21:09:29 +0000
Subject: [PATCH 06/10] Remove
installer::existence::exists_in_array_of_hashes.
---
solenv/bin/modules/installer/existence.pm | 20 --------------------
solenv/bin/modules/installer/setupscript.pm | 26 +++++++++-----------------
2 files changed, 9 insertions(+), 37 deletions(-)
diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm
index 1f362f7..0581efd 100644
--- a/solenv/bin/modules/installer/existence.pm
+++ b/solenv/bin/modules/installer/existence.pm
@@ -49,26 +49,6 @@ sub exists_in_array
return $alreadyexists;
}
-sub exists_in_array_of_hashes
-{
- my ($searchkey, $searchvalue, $arrayref) = @_;
-
- my $valueexists = 0;
-
- for ( my $i = 0; $i <= $#{$arrayref}; $i++ )
- {
- my $hashref = ${$arrayref}[$i];
-
- if ( $hashref->{$searchkey} eq $searchvalue )
- {
- $valueexists = 1;
- last;
- }
- }
-
- return $valueexists;
-}
-
#####################################################################
# Returning a specified file as base for the new
# configuration file, defined by its "gid"
diff --git a/solenv/bin/modules/installer/setupscript.pm
b/solenv/bin/modules/installer/setupscript.pm
index cbd2cbd..2275cd1 100644
--- a/solenv/bin/modules/installer/setupscript.pm
+++ b/solenv/bin/modules/installer/setupscript.pm
@@ -29,7 +29,6 @@ package installer::setupscript;
use base 'Exporter';
-use installer::existence;
use installer::exiter;
use installer::globals;
use installer::logger qw(globallog);
@@ -393,23 +392,16 @@ sub add_predefined_folder
{
my ( $folderitemref, $folderref ) = @_;
- for ( my $i = 0; $i <= $#{$folderitemref}; $i++ )
- {
- my $folderitem = ${$folderitemref}[$i];
- my $folderid = $folderitem->{'FolderID'};
-
- if ( $folderid =~ /PREDEFINED_/ )
- {
- if (! installer::existence::exists_in_array_of_hashes("gid", $folderid, $folderref))
- {
- my %folder = ();
- $folder{'ismultilingual'} = "0";
- $folder{'Name'} = "";
- $folder{'gid'} = $folderid;
+ for my $folderid ( map { $_->{FolderID} } @{$folderitemref} ) {
+ # FIXME: Anchor to start of line?
+ next unless ( $folderid =~ /PREDEFINED_/ );
+ next if grep { $_->{gid} eq $folderid } @{$folderref};
- push(@{$folderref}, \%folder);
- }
- }
+ push @{$folderref}, {
+ ismultilingual => 0,
+ Name => "",
+ gid => $folderid,
+ };
}
}
--
1.7.8.3
From 9a422a13975fd760807b87494f16e9d965923e52 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 22:00:53 +0000
Subject: [PATCH 07/10] Remove installer::existence::exists_in_array.
---
solenv/bin/make_installer.pl | 2 +-
solenv/bin/modules/installer/archivefiles.pm | 8 +++---
solenv/bin/modules/installer/epmfile.pm | 2 +-
solenv/bin/modules/installer/existence.pm | 22 --------------------
solenv/bin/modules/installer/languages.pm | 2 +-
solenv/bin/modules/installer/profiles.pm | 2 +-
solenv/bin/modules/installer/scriptitems.pm | 6 ++--
solenv/bin/modules/installer/strip.pm | 2 +-
solenv/bin/modules/installer/systemactions.pm | 2 +-
solenv/bin/modules/installer/windows/component.pm | 2 +-
solenv/bin/modules/installer/windows/feature.pm | 2 +-
.../modules/installer/windows/featurecomponent.pm | 4 +-
solenv/bin/modules/installer/windows/registry.pm | 2 +-
solenv/bin/modules/installer/windows/removefile.pm | 2 +-
solenv/bin/modules/installer/windows/shortcut.pm | 4 +-
solenv/bin/modules/installer/windows/strip.pm | 2 +-
solenv/bin/modules/installer/worker.pm | 2 +-
solenv/bin/modules/installer/xpdinstaller.pm | 6 ++--
solenv/bin/modules/installer/ziplist.pm | 2 +-
19 files changed, 27 insertions(+), 49 deletions(-)
diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl
index 47d137c..a823306 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 21f8f2b..a81b0f6 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 b7299ef..6a91fb4 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 0581efd..1346372 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 82ac7d0..b6bf0a1 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 2b794ce..22e18e6 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 4614c3f..67db9ef 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 a954187..777b773 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 559953a..899ad24 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 da11997..7a23080 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 92d8cfe..dbc0efa 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 8e9ebee..1079218 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 ba9f7a8..8312e56 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 ec2a614..ec12636 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 6c73f77..cef5020 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 79b1046..6f9f983 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 6f6801a..be24ff7 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 ac38b64..26059a7 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 3219e71..d513741 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);
}
--
1.7.8.3
From d244d5a85ab272e1cb9dc5ba5a19f47eee55f81b Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 22:29:26 +0000
Subject: [PATCH 08/10] Remove
installer::existence::get_specified_file_by_name.
---
solenv/bin/modules/installer/existence.pm | 32 -----------------------------
solenv/bin/modules/installer/worker.pm | 5 +++-
2 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm
index 1346372..95ba40d 100644
--- a/solenv/bin/modules/installer/existence.pm
+++ b/solenv/bin/modules/installer/existence.pm
@@ -63,36 +63,4 @@ sub get_specified_file
return $onefile;
}
-#####################################################################
-# Returning a specified file as base for a new file,
-# defined by its "Name"
-#####################################################################
-
-sub get_specified_file_by_name
-{
- my ($filesarrayref, $searchname) = @_;
-
- my $foundfile = 0;
- my $onefile;
-
- for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
- {
- $onefile = ${$filesarrayref}[$i];
- my $filename = $onefile->{'Name'};
-
- if ( $filename eq $searchname )
- {
- $foundfile = 1;
- last;
- }
- }
-
- if (!($foundfile))
- {
- installer::exiter::exit_program("ERROR: Could not find file $searchname in list of
files!", "get_specified_file_by_name");
- }
-
- return $onefile;
-}
-
1;
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index be24ff7..6592d08 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -1403,7 +1403,10 @@ sub prepare_windows_patchfiles
my $winpatchdirname = "winpatch";
my $winpatchdir = installer::systemactions::create_directories($winpatchdirname,
$languagestringref);
- my $patchlistfile = installer::existence::get_specified_file_by_name($filesref,
$patchfilename);
+ my ($patchlistfile) = grep {$_->{Name} eq $patchfilename} @{$filesref};
+ if (! defined $patchlistfile) {
+ installer::exiter::exit_program("ERROR: Could not find file $patchfilename in list of
files!", "prepare_windows_patchfiles");
+ }
# reorganizing the patchfile content, sorting for directory to decrease the file size
my $sorteddirectorylist = [ sort keys %patchfiledirectories ];
--
1.7.8.3
From 4451c31fdd1f30a7a35324e54fb99f11b6a5d992 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 23:01:27 +0000
Subject: [PATCH 09/10] 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(-)
diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm
index 95ba40d..cb9ab1d 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 22e18e6..156796e 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 cc3d87e..ab1c4f7 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 044a1af..a0dee6c 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 de279da..9afe6cd 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 6592d08..13089d5 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);
--
1.7.8.3
From e3cdfc4b94b2fed569a41a48e06165220154faba Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Fri, 17 Feb 2012 23:03:29 +0000
Subject: [PATCH 10/10] Remove installer::existence.
---
solenv/bin/modules/installer/archivefiles.pm | 1 -
solenv/bin/modules/installer/epmfile.pm | 1 -
solenv/bin/modules/installer/existence.pm | 30 --------------------
solenv/bin/modules/installer/helppack.pm | 1 -
solenv/bin/modules/installer/languagepack.pm | 1 -
solenv/bin/modules/installer/languages.pm | 1 -
solenv/bin/modules/installer/profiles.pm | 1 -
solenv/bin/modules/installer/scriptitems.pm | 1 -
solenv/bin/modules/installer/strip.pm | 1 -
solenv/bin/modules/installer/windows/binary.pm | 1 -
solenv/bin/modules/installer/windows/component.pm | 1 -
.../bin/modules/installer/windows/createfolder.pm | 1 -
solenv/bin/modules/installer/windows/feature.pm | 1 -
.../modules/installer/windows/featurecomponent.pm | 1 -
solenv/bin/modules/installer/windows/file.pm | 1 -
solenv/bin/modules/installer/windows/idtglobal.pm | 1 -
solenv/bin/modules/installer/windows/inifile.pm | 1 -
solenv/bin/modules/installer/windows/shortcut.pm | 1 -
solenv/bin/modules/installer/windows/sign.pm | 1 -
solenv/bin/modules/installer/windows/strip.pm | 1 -
solenv/bin/modules/installer/worker.pm | 1 -
solenv/bin/modules/installer/ziplist.pm | 1 -
22 files changed, 0 insertions(+), 51 deletions(-)
delete mode 100644 solenv/bin/modules/installer/existence.pm
diff --git a/solenv/bin/modules/installer/archivefiles.pm
b/solenv/bin/modules/installer/archivefiles.pm
index a81b0f6..8d682e4 100644
--- a/solenv/bin/modules/installer/archivefiles.pm
+++ b/solenv/bin/modules/installer/archivefiles.pm
@@ -29,7 +29,6 @@ package installer::archivefiles;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm
index 6a91fb4..1ec035c 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -29,7 +29,6 @@ package installer::epmfile;
use Cwd;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/existence.pm b/solenv/bin/modules/installer/existence.pm
deleted file mode 100644
index cb9ab1d..0000000
--- a/solenv/bin/modules/installer/existence.pm
+++ /dev/null
@@ -1,30 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-package installer::existence;
-
-1;
diff --git a/solenv/bin/modules/installer/helppack.pm b/solenv/bin/modules/installer/helppack.pm
index e4fad37..977b0ba 100644
--- a/solenv/bin/modules/installer/helppack.pm
+++ b/solenv/bin/modules/installer/helppack.pm
@@ -28,7 +28,6 @@
package installer::helppack;
use installer::converter;
-use installer::existence;
use installer::files;
use installer::globals;
use installer::logger;
diff --git a/solenv/bin/modules/installer/languagepack.pm
b/solenv/bin/modules/installer/languagepack.pm
index 9c8e16c..1bfcd8a 100644
--- a/solenv/bin/modules/installer/languagepack.pm
+++ b/solenv/bin/modules/installer/languagepack.pm
@@ -28,7 +28,6 @@
package installer::languagepack;
use installer::converter;
-use installer::existence;
use installer::files;
use installer::globals;
use installer::logger;
diff --git a/solenv/bin/modules/installer/languages.pm b/solenv/bin/modules/installer/languages.pm
index b6bf0a1..757ea9d 100644
--- a/solenv/bin/modules/installer/languages.pm
+++ b/solenv/bin/modules/installer/languages.pm
@@ -28,7 +28,6 @@
package installer::languages;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::globals;
use installer::remover;
diff --git a/solenv/bin/modules/installer/profiles.pm b/solenv/bin/modules/installer/profiles.pm
index 156796e..fba586b 100644
--- a/solenv/bin/modules/installer/profiles.pm
+++ b/solenv/bin/modules/installer/profiles.pm
@@ -28,7 +28,6 @@
package installer::profiles;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/scriptitems.pm
b/solenv/bin/modules/installer/scriptitems.pm
index 67db9ef..ac678be 100644
--- a/solenv/bin/modules/installer/scriptitems.pm
+++ b/solenv/bin/modules/installer/scriptitems.pm
@@ -28,7 +28,6 @@
package installer::scriptitems;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::globals;
use installer::languages;
diff --git a/solenv/bin/modules/installer/strip.pm b/solenv/bin/modules/installer/strip.pm
index 777b773..154f39b 100644
--- a/solenv/bin/modules/installer/strip.pm
+++ b/solenv/bin/modules/installer/strip.pm
@@ -28,7 +28,6 @@
package installer::strip;
use installer::converter;
-use installer::existence;
use installer::globals;
use installer::logger;
use installer::pathanalyzer;
diff --git a/solenv/bin/modules/installer/windows/binary.pm
b/solenv/bin/modules/installer/windows/binary.pm
index 96ee50e..bc5eeaf 100644
--- a/solenv/bin/modules/installer/windows/binary.pm
+++ b/solenv/bin/modules/installer/windows/binary.pm
@@ -27,7 +27,6 @@
package installer::windows::binary;
-use installer::existence;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/component.pm
b/solenv/bin/modules/installer/windows/component.pm
index 7a23080..7238260 100644
--- a/solenv/bin/modules/installer/windows/component.pm
+++ b/solenv/bin/modules/installer/windows/component.pm
@@ -28,7 +28,6 @@
package installer::windows::component;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/createfolder.pm
b/solenv/bin/modules/installer/windows/createfolder.pm
index ab1c4f7..5f42ee7 100644
--- a/solenv/bin/modules/installer/windows/createfolder.pm
+++ b/solenv/bin/modules/installer/windows/createfolder.pm
@@ -27,7 +27,6 @@
package installer::windows::createfolder;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/feature.pm
b/solenv/bin/modules/installer/windows/feature.pm
index dbc0efa..80f7954 100644
--- a/solenv/bin/modules/installer/windows/feature.pm
+++ b/solenv/bin/modules/installer/windows/feature.pm
@@ -27,7 +27,6 @@
package installer::windows::feature;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/featurecomponent.pm
b/solenv/bin/modules/installer/windows/featurecomponent.pm
index 1079218..580630f 100644
--- a/solenv/bin/modules/installer/windows/featurecomponent.pm
+++ b/solenv/bin/modules/installer/windows/featurecomponent.pm
@@ -28,7 +28,6 @@
package installer::windows::featurecomponent;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/file.pm
b/solenv/bin/modules/installer/windows/file.pm
index a0dee6c..100bf9a 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -28,7 +28,6 @@
package installer::windows::file;
use Digest::MD5;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm
b/solenv/bin/modules/installer/windows/idtglobal.pm
index 76e4988..baa4e77 100644
--- a/solenv/bin/modules/installer/windows/idtglobal.pm
+++ b/solenv/bin/modules/installer/windows/idtglobal.pm
@@ -29,7 +29,6 @@ package installer::windows::idtglobal;
use Cwd;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/inifile.pm
b/solenv/bin/modules/installer/windows/inifile.pm
index 9afe6cd..d13fafc 100644
--- a/solenv/bin/modules/installer/windows/inifile.pm
+++ b/solenv/bin/modules/installer/windows/inifile.pm
@@ -27,7 +27,6 @@
package installer::windows::inifile;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/shortcut.pm
b/solenv/bin/modules/installer/windows/shortcut.pm
index cef5020..4b7ff36 100644
--- a/solenv/bin/modules/installer/windows/shortcut.pm
+++ b/solenv/bin/modules/installer/windows/shortcut.pm
@@ -27,7 +27,6 @@
package installer::windows::shortcut;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/windows/sign.pm
b/solenv/bin/modules/installer/windows/sign.pm
index 8fb7b3f..a874fa6 100644
--- a/solenv/bin/modules/installer/windows/sign.pm
+++ b/solenv/bin/modules/installer/windows/sign.pm
@@ -29,7 +29,6 @@ package installer::windows::sign;
use Cwd;
use installer::converter;
-use installer::existence;
use installer::files;
use installer::globals;
use installer::scriptitems;
diff --git a/solenv/bin/modules/installer/windows/strip.pm
b/solenv/bin/modules/installer/windows/strip.pm
index 6f9f983..8cccba1 100644
--- a/solenv/bin/modules/installer/windows/strip.pm
+++ b/solenv/bin/modules/installer/windows/strip.pm
@@ -29,7 +29,6 @@ package installer::windows::strip;
use File::Temp qw(tmpnam);
use installer::converter;
-use installer::existence;
use installer::globals;
use installer::logger;
use installer::pathanalyzer;
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index 13089d5..1d3d19a 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -34,7 +34,6 @@ use File::Temp qw(tmpnam);
use File::Path;
use installer::control;
use installer::converter;
-use installer::existence;
use installer::exiter;
use installer::files;
use installer::globals;
diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm
index d513741..5ee0bb6 100644
--- a/solenv/bin/modules/installer/ziplist.pm
+++ b/solenv/bin/modules/installer/ziplist.pm
@@ -27,7 +27,6 @@
package installer::ziplist;
-use installer::existence;
use installer::exiter;
use installer::globals;
use installer::logger;
--
1.7.8.3
Context
- [PATCH] Remove "<foo>::existence" Perl modules. · Tim Retout
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.