diff options
Diffstat (limited to 'pm/MGATools/rpmsrate.pm')
-rw-r--r-- | pm/MGATools/rpmsrate.pm | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/pm/MGATools/rpmsrate.pm b/pm/MGATools/rpmsrate.pm index a027886..64d67ed 100644 --- a/pm/MGATools/rpmsrate.pm +++ b/pm/MGATools/rpmsrate.pm @@ -73,21 +73,24 @@ sub preread_rpmsrate { (\@rpmsrate, \%potloc); } +sub lookup_pkg { + my ($key, $fullpath, $urpm2, $o_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]; +} + sub check_if_expandable { my ($key, $raw, $fullpath, $potloc, $locale, $localized_pkg, $urpm2, $o_urpm) = @_; my ($pg, $loc) = $raw =~ /^(.*)-([^-+]+)$/; return if !$pg || !$loc; return if !$potloc->{$pg}; - - my $pkg; - # try to lookup package in urpm first (if we got an $urpm and if media were parsed): - $pkg = $o_urpm->{rpm}{$o_urpm->{rpmkey}{key}{$key}} if ref($o_urpm); - # if package is not urpmi' synthesis, try to parse it directly: - if (!$pkg) { - my $id = $urpm2->parse_rpm($fullpath); - $pkg = $urpm2->{depslist}[$id]; - } + my $pkg = lookup_pkg($key, $fullpath, $urpm2, $o_urpm); # still nothing? bailout: if (!$pkg) { |