Update to m13
[ooovba.git] / applied_patches / 0089-speed-make-installer-2.diff
blob4b60d6995f9051cc01ba04e3411f0a8a09c8c856
1 diff -u -r solenv/bin-pristine/make_installer.pl solenv/bin/make_installer.pl
2 --- solenv/bin-pristine/make_installer.pl 2008-11-25 19:22:01.000000000 +0000
3 +++ solenv/bin/make_installer.pl 2008-12-12 15:25:33.000000000 +0000
4 @@ -382,7 +382,7 @@
5 installer::setupscript::resolve_lowercase_productname_setupscriptvariable($allscriptvariablesref);
6 if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "setupscriptvariables3.log" ,$allscriptvariablesref); }
8 -installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref, $allscriptvariablesref);
9 +$setupscriptref = installer::setupscript::replace_all_setupscriptvariables_in_script($setupscriptref, $allscriptvariablesref);
10 if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "setupscript2.log" ,$setupscriptref); }
12 # Adding all variables defined in the installation object into the hash of all variables.
14 diff -u -r solenv/bin-pristine/modules/installer/setupscript.pm solenv/bin/modules/installer/setupscript.pm
15 --- solenv/bin/modules/installer/setupscript.pm.old 2009-04-02 12:53:08.000000000 +0200
16 +++ solenv/bin/modules/installer/setupscript.pm 2009-04-03 20:30:33.000000000 +0200
17 @@ -248,22 +248,30 @@ sub replace_all_setupscriptvariables_in_
21 - for ( my $i = 0; $i <= $#{$scriptref}; $i++ )
22 - {
23 - my $line = ${$scriptref}[$i];
25 - if ( $line =~ /^.*\%\w+.*$/ ) # only oif "%" occurs
26 - {
27 - # Attention: It must be possible to substitute "%PRODUCTNAMEn", "%PRODUCTNAME%PRODUCTVERSIONabc"
29 - foreach my $key ( keys %subs )
30 - {
31 - my $value = $subs{$key};
32 - $line =~ s/$key/$value/g;
33 - ${$scriptref}[$i] = $line;
34 - }
35 - }
36 + # This is far faster than running a regexp for each line
37 + my $bigstring = '';
38 + for my $line (@{$scriptref}) {
39 + $bigstring = $bigstring . $line;
40 + }
41 + foreach my $key ( keys %subs )
42 + {
43 + # Attention: It must be possible to substitute "%PRODUCTNAMEn", "%PRODUCTNAME%PRODUCTVERSIONabc"
44 + my $value = $subs{$key};
45 + $bigstring =~ s/$key/$value/g;
46 + }
47 + my @newlines = split /\n/, $bigstring;
48 + $scriptref = \@newlines;
50 + # now check for any mis-named '%' variables that we have left
51 + my $num = 0;
52 + for my $check (@newlines) {
53 + $num++;
54 + if ( $check =~ /^.*\%\w+.*$/ ) {
55 + print STDERR "Warning: mis-named or un-known '%' variable at line $num:\n$check\n";
56 + }
59 + return $scriptref;
62 #######################################################################