summaryrefslogtreecommitdiffstats
path: root/pm/MGATools/rpmsrate.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-03-15 12:30:46 +0000
committerThierry Vignaud <tv@mageia.org>2012-03-15 12:30:46 +0000
commit71faac3c9b8a6471eb6955b9fc614071943322db (patch)
tree7e7a4dd614d2a4e1d7ea84cab2c514cf22b148e7 /pm/MGATools/rpmsrate.pm
parent5a5c10bca19f792c127dfb77e7335dac9dd5bb4e (diff)
downloadmgatools-71faac3c9b8a6471eb6955b9fc614071943322db.tar
mgatools-71faac3c9b8a6471eb6955b9fc614071943322db.tar.gz
mgatools-71faac3c9b8a6471eb6955b9fc614071943322db.tar.bz2
mgatools-71faac3c9b8a6471eb6955b9fc614071943322db.tar.xz
mgatools-71faac3c9b8a6471eb6955b9fc614071943322db.zip
(lookup_pkg) split it out of check_if_expandable()
Diffstat (limited to 'pm/MGATools/rpmsrate.pm')
-rw-r--r--pm/MGATools/rpmsrate.pm21
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) {