diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 13:49:13 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 13:49:13 +0000 |
commit | 0ea7816a4ddb4e37dc93ec7012a6a17a36859e1a (patch) | |
tree | 63e602aa17d22d9043998759bf9864183d672317 /solenv/bin/modules/installer/packagelist.pm | |
parent | 5cd9473b1ae09320b2c7c896af484af5770158f2 (diff) |
INTEGRATION: CWS native141 (1.15.24); FILE MERGED
2008/04/04 12:05:25 is 1.15.24.1: #i87401# fix performance problem for multilanguage installation sets
Diffstat (limited to 'solenv/bin/modules/installer/packagelist.pm')
-rw-r--r-- | solenv/bin/modules/installer/packagelist.pm | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/solenv/bin/modules/installer/packagelist.pm b/solenv/bin/modules/installer/packagelist.pm index 4cc02beeb41f..81338fca4f63 100644 --- a/solenv/bin/modules/installer/packagelist.pm +++ b/solenv/bin/modules/installer/packagelist.pm @@ -8,7 +8,7 @@ # # $RCSfile: packagelist.pm,v $ # -# $Revision: 1.17 $ +# $Revision: 1.18 $ # # This file is part of OpenOffice.org. # @@ -71,6 +71,8 @@ sub analyze_list @allpackages = (); + my $moduleshash = get_module_hash($moduleslist); + for ( my $i = 0; $i <= $#{$packagelist}; $i++ ) { my $onepackage = ${$packagelist}[$i]; @@ -87,7 +89,8 @@ sub analyze_list push(@allmodules, $onegid); - get_children($moduleslist, $onegid, \@allmodules); + # get_children($moduleslist, $onegid, \@allmodules); + get_children_with_hash($moduleshash, $onegid, \@allmodules); $onepackage->{'allmodules'} = \@allmodules; @@ -97,6 +100,49 @@ sub analyze_list return \@allpackages; } +################################################### +# Creating a hash, that contains the module gids +# as keys and the parentids as values +################################################### + +sub get_module_hash +{ + my ($moduleslist) = @_; + + my %modulehash = (); + + for ( my $i = 0; $i <= $#{$moduleslist}; $i++ ) + { + my $gid = ${$moduleslist}[$i]->{'gid'}; + # Containing only modules with parent. Root modules can be ignored. + if ( ${$moduleslist}[$i]->{'ParentID'} ) { $modulehash{$gid} = ${$moduleslist}[$i]->{'ParentID'}; } + } + + return \%modulehash; +} + +######################################################## +# Recursively defined procedure to order +# modules and directories +######################################################## + +sub get_children_with_hash +{ + my ($modulehash, $parentgid, $newitemorder) = @_; + + foreach my $gid ( keys %{$modulehash} ) + { + my $parent = $modulehash->{$gid}; + + if ( $parent eq $parentgid ) + { + push(@{$newitemorder}, $gid); + my $parent = $gid; + get_children_with_hash($modulehash, $parent, $newitemorder); # recursive! + } + } +} + ######################################################## # Recursively defined procedure to order # modules and directories |