diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-23 09:47:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-08-23 09:58:26 +0200 |
commit | 52755d6d2cf1c6addaf3c91b93bb86d66b730409 (patch) | |
tree | a4bcb7df4c38ddf3c683a8b051d45eb29fedb2f4 /solenv/bin/modules/installer/scpzipfiles.pm | |
parent | fcd990f208be4430157dca2d6093337f21cb079b (diff) |
Revert "installer: Use hashref for replace_all_ziplistvariables_in_rtffile"
This reverts commit 46a977081c6f1886f8fff8457c85e6d426dcc20f. It started to
replace occurrences of "${...}" unknown to the installer with empty strings,
instead of keeping them as-is. This caused the "${ORIGIN}" at the start of the
value for URE_BOOTSTRAP to disappear from the soffice ini-file (cf.
gid_Brand_Profileitem_Soffice_UreBootstrap in scp2/source/ooo/common_brand.scp),
making soffice fail to start completely.
Change-Id: Ia7a34179b78677a703fc487401e011073d14a176
Diffstat (limited to 'solenv/bin/modules/installer/scpzipfiles.pm')
-rw-r--r-- | solenv/bin/modules/installer/scpzipfiles.pm | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/solenv/bin/modules/installer/scpzipfiles.pm b/solenv/bin/modules/installer/scpzipfiles.pm index 70283f2b8c35..cb0e6408e565 100644 --- a/solenv/bin/modules/installer/scpzipfiles.pm +++ b/solenv/bin/modules/installer/scpzipfiles.pm @@ -39,26 +39,60 @@ use installer::systemactions; sub replace_all_ziplistvariables_in_file { - my ( $fileref, $variablesref ) = @_; + my ( $fileref, $variableshashref ) = @_; - for my $line ( @{$fileref} ) + for ( my $i = 0; $i <= $#{$fileref}; $i++ ) { - $line =~ s/\$\{(\w+)\}/$variablesref->{$1}/eg; + my $line = ${$fileref}[$i]; + + if ( $line =~ /^.*\$\{\w+\}.*$/ ) # only occurrence of ${abc} + { + my $key; + + foreach $key (keys %{$variableshashref}) + { + my $value = $variableshashref->{$key}; + $key = '${' . $key . '}'; + $line =~ s/\Q$key\E/$value/g; + ${$fileref}[$i] = $line; + } + } } } ######################################################################################## -# Replacing all zip list variables in rtf files. +# Replacing all zip list variables in rtf files. In rtf files +# the brackets are masked. ######################################################################################## sub replace_all_ziplistvariables_in_rtffile { - my ( $fileref, $variablesref ) = @_; + my ( $fileref, $variablesref, $onelanguage, $loggingdir ) = @_; - for my $line ( @{$fileref} ) + for ( my $i = 0; $i <= $#{$fileref}; $i++ ) { - # In rtf files the braces are backslash-escaped. - $line =~ s/\$\\\{(\w+)\\\}/$variablesref->{$1}/eg; + my $line = ${$fileref}[$i]; + + if ( $line =~ /^.*\$\\\{\w+\\\}.*$/ ) # only occurrence of $\{abc\} + { + for ( my $j = 0; $j <= $#{$variablesref}; $j++ ) + { + my $variableline = ${$variablesref}[$j]; + + my ($key, $value); + + if ( $variableline =~ /^\s*([\w-]+?)\s+(.*?)\s*$/ ) + { + $key = $1; + $value = $2; + $key = '$\{' . $key . '\}'; + } + + $line =~ s/\Q$key\E/$value/g; + + ${$fileref}[$i] = $line; + } + } } } |