On 2011-01-28 Michael Meeks wrote: > > > Can you confirm your work is under LGPLv3+/MPL please too ? > > Yes, of course. The patch is released under LGPLv3+. > > Heh - we ask for a dual LGPLv3+ -and- MPL license for changes; so > LGPLv3+/MPL is the question :-)
OK, it's LGPLv3+/MPL then. I have attached another patch. It makes get_all_items_from_script run about twice as fast. According to http://users.freedesktop.org/~michael/make_installer.txt that should save ~5-7% time on windows. Oh, and the patch is LGPLv3+/MPL ;-) regards, Jan
>From 45afa54efa76d7b853b29cd028437134f8425933 Mon Sep 17 00:00:00 2001 From: Jan Darmochwal <[email protected]> Date: Thu, 3 Feb 2011 12:30:37 +0100 Subject: [PATCH] Accelerate Perl installer builder speed up get_all_items_from_script --- solenv/bin/modules/installer/remover.pm | 4 +- solenv/bin/modules/installer/setupscript.pm | 127 +++++++++++--------------- 2 files changed, 56 insertions(+), 75 deletions(-) diff --git a/solenv/bin/modules/installer/remover.pm b/solenv/bin/modules/installer/remover.pm index 75af6e8..2c039ec 100644 --- a/solenv/bin/modules/installer/remover.pm +++ b/solenv/bin/modules/installer/remover.pm @@ -37,8 +37,8 @@ sub remove_leading_and_ending_whitespaces { my ( $stringref ) = @_; - $$stringref =~ s/^\s*//; - $$stringref =~ s/\s*$//; + $$stringref =~ s/^\s+//; + $$stringref =~ s/\s+$//; } sub remove_leading_and_ending_quotationmarks diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index 7d3f77f..4e2fbf6 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -303,94 +303,75 @@ sub get_all_items_from_script my ($scriptref, $searchitem) = @_; my @allitemarray = (); - - my ($itemkey, $itemvalue, $valuecounter); + + my ($itemkey, $itemvalue); for ( my $i = 0; $i <= $#{$scriptref}; $i++ ) { my $line = ${$scriptref}[$i]; - - if ( $line =~ /^\s*\Q$searchitem\E\s+(\S+)\s*$/ ) + + next unless ($line =~ /^\s*\Q$searchitem\E\s+(\S+)\s*$/); + my $gid = $1; + + my %oneitemhash = (); + my $ismultilang = 0; + + $oneitemhash{'gid'} = $gid; + + while (!( $line =~ /^\s*End\s*$/ )) { - my $gid = $1; - my $counter = $i + 1; - - my %oneitemhash = (); - my $ismultilang = 0; - - $oneitemhash{'gid'} = $gid; - - while (!( $line =~ /^\s*End\s*$/ )) + if ( $i >= $#{$scriptref} ) { + installer::exiter::exit_program("Invalid setup script file. End of file reached before 'End' line of '$searchitem' section.", "get_all_items_from_script"); + } + $line = ${$scriptref}[++$i]; + + if ( $line =~ /^\s*(.+?)\=\s*(.+?)\;\s*$/ ) # only oneliner! { - if ( $counter > $#{$scriptref} ) { - installer::exiter::exit_program("Invalid setup script file. End of file reached before 'End' line of '$searchitem' section.", "get_all_items_from_script"); - } - $line = ${$scriptref}[$counter]; - $counter++; + $itemkey = $1; + $itemvalue = $2; - if ( $line =~ /^\s*(.+?)\s*\=\s*(.+?)\s*\;\s*$/ ) # only oneliner! - { - $itemkey = $1; - $itemvalue = $2; + $itemkey =~ s/\s+$//; + $itemvalue =~ s/\s+$//; - installer::remover::remove_leading_and_ending_quotationmarks(\$itemvalue); - $itemvalue =~ s/\s*$//; # removing ending whitespaces. Could be introduced by empty variables. + installer::remover::remove_leading_and_ending_quotationmarks(\$itemvalue); - $oneitemhash{$itemkey} = $itemvalue; + $oneitemhash{$itemkey} = $itemvalue; - if ( $itemkey =~ /^\s*\S+\s+\(\S+\)\s*$/ ) - { - $ismultilang = 1; - } - } - else + $ismultilang ||= $itemkey =~ /^\S+\s+\(\S+\)$/; + } + elsif (($searchitem eq "Module") && + ($line =~ /^\s*.+?\s*\=\s*\(/) && + (!($line =~ /\)\;\s*$/))) # more than one line, for instance files at modules! + { + $line =~ /^\s*(.+?)\s*\=\s*(.+?)\s*$/; # the first line + $itemkey = $1; + $itemvalue = $2; + + # collecting the complete itemvalue + do { - if ( $searchitem eq "Module" ) # more than one line, for instance files at modules! - { - if (( $line =~ /^\s*(.+?)\s*\=\s*\(/ ) && (!($line =~ /\)\;\s*$ / ))) - { - if ( $line =~ /^\s*(.+?)\s*\=\s*(.+)/ ) # the first line - { - $itemkey = $1; - $itemvalue = $2; - $itemvalue =~ s/\s*$//; - } - - # collecting the complete itemvalue - - $valuecounter = $counter; - $line = ${$scriptref}[$valuecounter]; - installer::remover::remove_leading_and_ending_whitespaces(\$line); - $itemvalue = $itemvalue . $line; - - while (!( $line =~ /\)\;\s*$/ )) - { - $valuecounter++; - $line = ${$scriptref}[$valuecounter]; - installer::remover::remove_leading_and_ending_whitespaces(\$line); - $itemvalue = $itemvalue . $line; - } - - # removing ending ";" - $itemvalue =~ s/\;\s*$//; - - $oneitemhash{$itemkey} = $itemvalue; - - if ( $itemkey =~ /^\s*\S+\s+\(\S+\)\s*$/ ) - { - $ismultilang = 1; - } - } + if ( $i >= $#{$scriptref} ) { + installer::exiter::exit_program("Invalid setup script file. Premature end of file.", "get_all_items_from_script"); } - } + $line = ${$scriptref}[++$i]; + installer::remover::remove_leading_and_ending_whitespaces(\$line); + $itemvalue .= $line; + } while (!($line =~ /\)\;\s*$/)); + + # removing ending ";" + $itemvalue =~ s/\;\s*$//; + + $oneitemhash{$itemkey} = $itemvalue; + + $ismultilang ||= $itemkey =~ /^\S+\s+\(\S+\)$/; } - - $oneitemhash{'ismultilingual'} = $ismultilang; - - push(@allitemarray, \%oneitemhash); } + + $oneitemhash{'ismultilingual'} = $ismultilang+0; + + push(@allitemarray, \%oneitemhash); } - + return \@allitemarray; } -- 1.7.1
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
