solenv/bin/make_installer.pl|8 +-
solenv/bin/modules/installer/sorter.pm | 89 +++-
solenv/bin/modules/installer/windows/feature.pm | 13 +--
solenv/bin/modules/installer/worker.pm | 20 -
solenv/bin/modules/t/installer-sorter.t | 48
5 files changed, 71 insertions(+), 107 deletions(-)
New commits:
commit 51f8f151780b6514d515b739e3167f36eb30787c
Author: Tim Retout t...@retout.co.uk
Date: Wed Feb 15 20:08:57 2012 +
Simplify installer::sorter::sorting_array_of_hashes.
diff --git a/solenv/bin/modules/installer/sorter.pm
b/solenv/bin/modules/installer/sorter.pm
index 54e5c34..b08dd80 100644
--- a/solenv/bin/modules/installer/sorter.pm
+++ b/solenv/bin/modules/installer/sorter.pm
@@ -44,26 +44,10 @@ sub sorting_array_of_hashes
{
my ($arrayref, $sortkey) = @_;
-for ( my $i = 0; $i = $#{$arrayref}; $i++ )
-{
-my $onehashunder = ${$arrayref}[$i];
-my $sortvalueunder = $onehashunder-{$sortkey};
-
-for ( my $j = $i + 1; $j = $#{$arrayref}; $j++ )
-{
-my $onehashover = ${$arrayref}[$j];
-my $sortvalueover = $onehashover-{$sortkey};
-
-if ( $sortvalueunder gt $sortvalueover)
-{
-${$arrayref}[$i] = $onehashover;
-${$arrayref}[$j] = $onehashunder;
-
-$onehashunder = $onehashover;
-$sortvalueunder = $sortvalueover;
-}
-}
-}
+@$arrayref = map { $_-[1] }
+ sort { $a-[0] cmp $b-[0] }
+ map { [$_-{$sortkey}, $_] }
+ @$arrayref;
}
1;
commit 01fde2e939cbc4aeeb15978febb5e2fa0396c125
Author: Tim Retout t...@retout.co.uk
Date: Wed Feb 15 19:00:10 2012 +
Add tests for installer::sorter
diff --git a/solenv/bin/modules/t/installer-sorter.t
b/solenv/bin/modules/t/installer-sorter.t
new file mode 100644
index 000..fe67b4e
--- /dev/null
+++ b/solenv/bin/modules/t/installer-sorter.t
@@ -0,0 +1,48 @@
+# 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 t...@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 lib '.';
+
+use Test::More;
+use List::Util 'shuffle';
+
+BEGIN {
+use_ok('installer::sorter', qw(
+sorting_array_of_hashes
+));
+}
+
+my @loh_str_sorted = map { { key = $_ } } (a..j);
+
+my @loh_str_random = shuffle @loh_str_sorted;
+
+sorting_array_of_hashes(\@loh_str_random, key);
+
+is_deeply(\@loh_str_random, \@loh_str_sorted);
+
+done_testing();
commit a1bc2d7d23e160bd9bb9570b4d512eee740aca15
Author: Tim Retout t...@retout.co.uk
Date: Wed Feb 15 18:50:06 2012 +
Use Exporter for installer::sorter
diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl
index 4f35aed..45dede0 100644
--- a/solenv/bin/make_installer.pl
+++ b/solenv/bin/make_installer.pl
@@ -57,7 +57,7 @@ use installer::scpzipfiles;
use installer::scriptitems;
use installer::setupscript;
use installer::simplepackage;
-use installer::sorter;
+use installer::sorter qw(sorting_array_of_hashes);
use installer::strip;
use installer::substfilenamefiles;
use installer::systemactions;
@@ -1101,7 +1101,7 @@ for ( my $n = 0; $n =
$#installer::globals::languageproducts; $n++ )
if ( $installer::globals::globallogging ) {
installer::files::save_array_of_hashes($loggingdir .
directoriesforepmlist3alangpack.log, $directoriesforepmarrayref); }
($directoriesforepmarrayref, $alldirectoryhash) =
installer::scriptitems::collect_directories_with_create_flag_from_directoryarray($dirsinproductlanguageresolvedarrayref,
$alldirectoryhash);
if ( $installer::globals::globallogging ) {
installer::files::save_array_of_hashes($loggingdir .
directoriesforepmlist3blangpack.log, $directoriesforepmarrayref); }
-installer::sorter::sorting_array_of_hashes($directoriesforepmarrayref,
HostName);
+sorting_array_of_hashes($directoriesforepmarrayref, HostName);