summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-03-11 15:01:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-03-11 15:01:14 +0000
commitf349023599f2fdc021bea2eb6a17c9eaa46aaaea (patch)
tree79703c7f92e830f7b0b03b592b609cce66c73660 /perl-install/pkgs.pm
parenta3d43c6d73a78f485bfb729604c2fd89333dcafa (diff)
downloaddrakx-backup-do-not-use-f349023599f2fdc021bea2eb6a17c9eaa46aaaea.tar
drakx-backup-do-not-use-f349023599f2fdc021bea2eb6a17c9eaa46aaaea.tar.gz
drakx-backup-do-not-use-f349023599f2fdc021bea2eb6a17c9eaa46aaaea.tar.bz2
drakx-backup-do-not-use-f349023599f2fdc021bea2eb6a17c9eaa46aaaea.tar.xz
drakx-backup-do-not-use-f349023599f2fdc021bea2eb6a17c9eaa46aaaea.zip
- add function packagesProviding()
- use it
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index f0495b352..a0bb7b0a7 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -132,6 +132,11 @@ sub size2time {
}
+sub packagesProviding {
+ my ($packages, $name) = @_;
+ map { $packages->{depslist}[$_] } keys %{$packages->{provides}{$name} || {}};
+}
+
#- searching and grouping methods.
#- package is a reference to list that contains
#- a hash to search by name and
@@ -141,8 +146,7 @@ sub packageByName {
#- search package with given name and compatible with current architecture.
#- take the best one found (most up-to-date).
my @packages;
- foreach (keys %{$packages->{provides}{$name} || {}}) {
- my $pkg = $packages->{depslist}[$_];
+ foreach my $pkg (packagesProviding($packages, $name)) {
$pkg->is_arch_compat or next;
$pkg->name eq $name or next;
push @packages, $pkg;
@@ -172,14 +176,13 @@ sub packages2kernels {
my ($packages) = @_;
map {
- my $pkg = $packages->{depslist}[$_];
- if (my ($ext, $version) = analyse_kernel_name($pkg->name)) {
- { pkg => $pkg, ext => $ext, version => $version };
+ if (my ($ext, $version) = analyse_kernel_name($_->name)) {
+ { pkg => $_, ext => $ext, version => $version };
} else {
- log::l("ERROR: unknown package " . $pkg->name . " providing kernel");
+ log::l("ERROR: unknown package " . $_->name . " providing kernel");
();
}
- } keys %{$packages->{provides}{kernel}};
+ } packagesProviding($packages, 'kernel');
}
sub bestKernelPackage {