diff options
Diffstat (limited to 'pm')
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index c2d519a..92857df 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -40,15 +40,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =cut -# function copied from Mkcd::Tools -sub cleanrpmsrate { - my ($rpmsrate, $output, $norpmsrate, $reprpms, $urpm) = @_; - $norpmsrate ||= []; - my $LOG; open $LOG, ">&STDERR"; +# must preread to get locale guessed packages +sub preread_rpmsrate { + my ($rpmsrate, $norpmsrate) = @_; my (@rpmsrate, %potloc); - - # must preread to get locale guessed packages - # postfix is just used not to break the diff when checking if the result is correct foreach (cat_or_die($rpmsrate)) { chomp; s/#.*//; @@ -66,6 +61,7 @@ sub cleanrpmsrate { next; } my ($indent, $r, $flags, $data) = /^(\s*)([1-5])?(\s*(?:(?:(?:!\s*)?[0-9A-Z_]+(?:"[^"]*")?(?:\s+(?:\|\|\s+)?)*)+\s+)|\s*)(.*)$/; + # postfix is just used not to break the diff when checking if the result is correct my ($postfix) = $data =~ /(\s*)$/; my (@data, $i); foreach ([$data =~ /(?:^|\s)(\S+)-(?:\S+)\s+\1-(?:\S+)(?:\s|$)/g], [split ' ', $data]) { @@ -74,6 +70,18 @@ sub cleanrpmsrate { $potloc{$_} = [] foreach @{$data[0]}; push @rpmsrate, [ $indent,$r, $flags, $data[1], $postfix ]; } + (\@rpmsrate, \%potloc); +} + +# function copied from Mkcd::Tools +sub cleanrpmsrate { + my ($rpmsrate, $output, $norpmsrate, $reprpms, $urpm) = @_; + $norpmsrate ||= []; + my $LOG; open $LOG, ">&STDERR"; + + my ($rsrate_ref, $poloc_ref) = preread_rpmsrate($rpmsrate, $norpmsrate); + my @rpmsrate = @$rsrate_ref; + my %potloc = %$poloc_ref; my (%rpms, $text, %rate, %section, %keyword, %locale, %localized_pkg); my @plain_flags = qw(INSTALL LIVE); |