summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-03-15 19:12:30 +0000
committerThierry Vignaud <tv@mageia.org>2012-03-15 19:12:30 +0000
commit3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9 (patch)
treefb8b5f808365e2f691f601876ad45bbf0c3f2df3
parent37f6f6bd07395158ea6c3831c1676e33063b6bda (diff)
downloadmgatools-3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9.tar
mgatools-3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9.tar.gz
mgatools-3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9.tar.bz2
mgatools-3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9.tar.xz
mgatools-3b9d8f4e7100d2c3b27955c61ddad7c6f16dfbb9.zip
(lookup_pkg,check_if_expandable,cleanrpmsrate) simplify: kill unused $o_urpm parameter (no overengeneering)
-rw-r--r--pm/MGATools/rpmsrate.pm20
1 files changed, 8 insertions, 12 deletions
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);
}
}
}