Fixed for i#103021
[ooovba.git] / applied_patches / 0088-speed-make-installer.diff
blob2b3feaef79005c88be4328fa337c0ba23e6df2e5
1 Index: modules/installer/scriptitems.pm
2 ===================================================================
3 RCS file: /cvs/tools/solenv/bin/modules/installer/scriptitems.pm,v
4 retrieving revision 1.51.18.2
5 diff -u -p -r1.51.18.2 scriptitems.pm
6 --- solenv/bin/modules/installer/scriptitems.pm 22 Aug 2008 09:16:03 -0000 1.51.18.2
7 +++ solenv/bin/modules/installer/scriptitems.pm 11 Dec 2008 07:06:08 -0000
8 @@ -2361,33 +2363,66 @@ sub resolve_links_with_flag_relative
9 # This function is a helper of function "assigning_modules_to_items"
10 ########################################################################
12 +sub insert_for_item ($$$)
14 + my ($hash, $item, $id) = @_;
16 +# print STDERR "insert '$id' for '$item'\n";
17 + if (!defined $hash->{$item}) {
18 + my @gids = ();
19 + $hash->{$item} = \@gids;
20 + }
21 + my $gid_list = $hash->{$item};
22 + push @{$gid_list}, $id;
23 + $hash->{$item} = $gid_list;
26 +sub build_modulegids_table
28 + my ($modulesref, $itemname) = @_;
29 + my %module_lookup_table;
31 + # build map of item names to list of respective module gids
32 + # containing these items
33 + for my $onemodule (@{$modulesref})
34 + {
35 + next if ( ! defined $onemodule->{$itemname} );
36 + # these are the items contained in this module
37 + # eg. Files = (gid_a_b_c,gid_d_e_f)
38 + my $module_gids = $onemodule->{$itemname};
40 + # prune outer brackets
41 + $module_gids =~ s|^\s*\(||g;
42 + $module_gids =~ s|\)\s*$||g;
43 + for my $id (split (/,/, $module_gids))
44 + {
45 + chomp $id;
46 + insert_for_item (\%module_lookup_table, lc ($id), $onemodule->{'gid'});
47 + }
48 + }
50 + return \%module_lookup_table;
53 sub get_string_of_modulegids_for_itemgid
55 - my ($modulesref, $itemgid, $itemname) = @_;
56 + my ($module_lookup_table, $modulesref, $itemgid, $itemname) = @_;
58 if ( $installer::globals::debug ) { installer::logger::debuginfo("installer::scriptitems::get_string_of_modulegids_for_itemgid : $#{$modulesref} : $itemgid : $itemname"); }
60 my $allmodules = "";
61 my $haslanguagemodule = 0;
62 my %foundmodules = ();
64 - for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
65 - {
66 - my $onemodule = ${$modulesref}[$i];
67 - my $allitems = "";
69 - if ( $onemodule->{$itemname} ) { $allitems = $onemodule->{$itemname}; }
71 - if ( $allitems =~ /\b$itemgid\b/i )
72 - {
73 - $allmodules = $allmodules . "," . $onemodule->{'gid'};
74 - $foundmodules{$onemodule->{'gid'}} = 1;
76 - # Is this module a language module? This info should be stored at the file.
77 - if ( exists($installer::globals::alllangmodules{$onemodule->{'gid'}}) ) { $haslanguagemodule = 1; }
78 - }
80 +# print STDERR "lookup '" . lc($itemgid) . "'\n";
81 + my $gid_list = $module_lookup_table->{lc($itemgid)};
83 + for my $gid (@{$gid_list}) {
84 + $foundmodules{$gid} = 1;
85 + $allmodules = $allmodules . "," . $gid;
86 + # Is this module a language module? This info should be stored at the file.
87 + if ( exists($installer::globals::alllangmodules{$gid}) ) { $haslanguagemodule = 1; }
90 $allmodules =~ s/^\s*\,//; # removing leading comma
92 # Check: All modules or no module must have flag LANGUAGEMODULE
93 @@ -2397,6 +2432,8 @@ sub get_string_of_modulegids_for_itemgid
94 if ( ! $isreallylanguagemodule ) { installer::exiter::exit_program("ERROR: \"$itemgid\" is assigned to modules with flag \"LANGUAGEMODULE\" and also to modules without this flag! Modules: $allmodules", "get_string_of_modulegids_for_itemgid"); }
97 +# print STDERR "get_string_for_itemgid ($itemgid, $itemname) => $allmodules, $haslanguagemodule\n";
99 return ($allmodules, $haslanguagemodule);
102 @@ -2414,10 +2451,11 @@ sub assigning_modules_to_items
103 my $infoline = "";
104 my $languageassignmenterror = 0;
105 my @languageassignmenterrors = ();
107 + my $module_lookup_table = build_modulegids_table($modulesref, $itemname);
109 - for ( my $i = 0; $i <= $#{$itemsref}; $i++ )
110 + for my $oneitem (@{$itemsref})
112 - my $oneitem = ${$itemsref}[$i];
113 my $itemgid = $oneitem->{'gid'};
115 my $styles = "";
116 @@ -2431,7 +2469,7 @@ sub assigning_modules_to_items
118 # every item can belong to many modules
120 - my ($modulegids, $haslanguagemodule) = get_string_of_modulegids_for_itemgid($modulesref, $itemgid, $itemname);
121 + my ($modulegids, $haslanguagemodule) = get_string_of_modulegids_for_itemgid($module_lookup_table,$modulesref, $itemgid, $itemname);
123 if ($modulegids eq "")