summaryrefslogtreecommitdiffstats
path: root/pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-03-15 08:20:23 +0000
committerThierry Vignaud <tv@mageia.org>2012-03-15 08:20:23 +0000
commite568fcb1a8cf5e139e32211133fde4b10a2a80ef (patch)
treed465672b42bc0d40ef1a31cdd095d3bf9e0af608 /pm
parent5dc357257f5aed61526bf964b3fb43315d611552 (diff)
downloadmgatools-e568fcb1a8cf5e139e32211133fde4b10a2a80ef.tar
mgatools-e568fcb1a8cf5e139e32211133fde4b10a2a80ef.tar.gz
mgatools-e568fcb1a8cf5e139e32211133fde4b10a2a80ef.tar.bz2
mgatools-e568fcb1a8cf5e139e32211133fde4b10a2a80ef.tar.xz
mgatools-e568fcb1a8cf5e139e32211133fde4b10a2a80ef.zip
(preread_rpmsrate) split it out of cleanrpmsrate()
Diffstat (limited to 'pm')
-rw-r--r--pm/MGATools/rpmsrate.pm24
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);