From 3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 15 Mar 2012 19:12:30 +0000 Subject: (lookup_pkg,check_if_expandable,cleanrpmsrate) simplify: kill unused $o_urpm parameter (no overengeneering) --- pm/MGATools/rpmsrate.pm | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'pm') diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index f5bb8f0..14bd2ac 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -72,23 +72,19 @@ sub preread_rpmsrate { } sub lookup_pkg { - my ($key, $fullpath, $urpm2, $o_urpm) = @_; + my ($fullpath, $urpm) = @_; - # try to lookup package in urpm first (if we got an $urpm and if media were parsed): - return $o_urpm->{rpm}{$o_urpm->{rpmkey}{key}{$key}} if ref($o_urpm); - - # if package is not urpmi' synthesis, try to parse it directly: - my $id = $urpm2->parse_rpm($fullpath); - return $urpm2->{depslist}[$id]; + my $id = $urpm->parse_rpm($fullpath); + return $urpm->{depslist}[$id]; } sub check_if_expandable { - my ($key, $raw, $fullpath, $potloc, $locale, $localized_pkg, $urpm2, $o_urpm) = @_; + my ($key, $raw, $fullpath, $potloc, $locale, $localized_pkg, $urpm) = @_; my ($pg, $loc) = $raw =~ /^(.*)-([^-+]+)$/; return if !$pg || !$loc; return if !$potloc->{$pg}; - my $pkg = lookup_pkg($key, $fullpath, $urpm2, $o_urpm); + my $pkg = lookup_pkg($fullpath, $urpm); # still nothing? bailout: if (!$pkg) { @@ -106,7 +102,7 @@ sub check_if_expandable { # function copied from Mkcd::Tools sub cleanrpmsrate { - my ($rpmsrate_file, $output, $reprpms, $o_urpm) = @_; + my ($rpmsrate_file, $output, $reprpms) = @_; my ($rpmsrate, $potloc) = preread_rpmsrate($rpmsrate_file); @@ -116,7 +112,7 @@ sub cleanrpmsrate { my $kernel_like = "((?:(?:NVIDIA_)?kernel|NVIDIA_nforce|cm2020).*)"; my $dkms_like = '(.*)([-_])kernel-([0-9]+(?:\.[0-9]+){2,3}-\w+-[0-9]+(?:.[^.]+){0,2}\.?mga\d+)(.*)'; my $rpmsrate_dkms_like = "(.*[-_]kernel)(.*)"; - my $urpm2 = URPM->new; + my $urpm = URPM->new; foreach my $dir (keys %$reprpms) { foreach (@{$reprpms->{$dir}}) { @@ -139,7 +135,7 @@ sub cleanrpmsrate { $rpms{$vname} = [ $3, $vname ]; } } else { - check_if_expandable($key, $_, "$dir/$rpm", $potloc, \%locale, \%localized_pkg, $urpm2, $o_urpm); + check_if_expandable($key, $_, "$dir/$rpm", $potloc, \%locale, \%localized_pkg, $urpm); } } } -- cgit v1.2.1