diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-03-15 19:12:27 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-03-15 19:12:27 +0000 |
commit | 37f6f6bd07395158ea6c3831c1676e33063b6bda (patch) | |
tree | 197e7710cb27adb4ebfa19364a285c81635bfcb3 | |
parent | 408d127d9af61e54f682fea9f4d2cec4d8e61461 (diff) | |
download | mgatools-37f6f6bd07395158ea6c3831c1676e33063b6bda.tar mgatools-37f6f6bd07395158ea6c3831c1676e33063b6bda.tar.gz mgatools-37f6f6bd07395158ea6c3831c1676e33063b6bda.tar.bz2 mgatools-37f6f6bd07395158ea6c3831c1676e33063b6bda.tar.xz mgatools-37f6f6bd07395158ea6c3831c1676e33063b6bda.zip |
(preread_rpmsrate,cleanrpmsrate) simplify: kill unused $norpmsrate parameter (no overengeneering)
-rwxr-xr-x | clean-rpmsrate | 2 | ||||
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 14 |
2 files changed, 6 insertions, 10 deletions
diff --git a/clean-rpmsrate b/clean-rpmsrate index 0ec4c3b..822690c 100755 --- a/clean-rpmsrate +++ b/clean-rpmsrate @@ -19,4 +19,4 @@ my $rpmsrate_base = shift @ARGV; foreach my $d (@ARGV) { $rpm{$d} = [ map { s!$d/?(.*)\.rpm$!$1!; $_ } glob "$d/*.rpm" ]; } -cleanrpmsrate($rpmsrate_base, $output_file, 0, \%rpm); +cleanrpmsrate($rpmsrate_base, $output_file, \%rpm); diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index 2459fa4..f5bb8f0 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # must preread to get locale guessed packages sub preread_rpmsrate { - my ($rpmsrate, $norpmsrate) = @_; + my ($rpmsrate) = @_; my (@rpmsrate, %potloc); foreach (cat_or_die($rpmsrate)) { chomp; @@ -63,10 +63,8 @@ sub preread_rpmsrate { 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]) { - $data[$i++] = [ @$norpmsrate ? any { my $r = $_; any { $r =~ /$_/ } @$norpmsrate ? @{[]} : $r } @$_ : @$_ ]; - } + my @data = ([ $data =~ /(?:^|\s)(\S+)-(?:\S+)\s+\1-(?:\S+)(?:\s|$)/g ], + [ split ' ', $data ]); $potloc{$_} = [] foreach @{$data[0]}; push @rpmsrate, [ $indent,$r, $flags, $data[1], $postfix ]; } @@ -108,10 +106,9 @@ sub check_if_expandable { # function copied from Mkcd::Tools sub cleanrpmsrate { - my ($rpmsrate_file, $output, $norpmsrate, $reprpms, $o_urpm) = @_; - $norpmsrate ||= []; + my ($rpmsrate_file, $output, $reprpms, $o_urpm) = @_; - my ($rpmsrate, $potloc) = preread_rpmsrate($rpmsrate_file, $norpmsrate); + my ($rpmsrate, $potloc) = preread_rpmsrate($rpmsrate_file); my (%rpms, $text, %rate, %section, %keyword, %locale, %localized_pkg); # LIVE & INSTALL keyswords are special: @@ -126,7 +123,6 @@ sub cleanrpmsrate { my $rpm = "$_.rpm"; my $key = $_; s/-[^-]+-[^-]+\.[^.]+$// or next; - any { $rpm =~ /$_/ } @$norpmsrate and next; if (/(.*?)([_-]*[\d._]+)(-.*)?-devel$/ || /^$kernel_like(-[^.]+(?:\.[^.]+){3,6}\.?mga\d+)$/) { if (!$rpms{"$1$3"} || URPM::ranges_overlap("== $2", "> $rpms{'$1$3'}")) { |