summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-09-02 09:52:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-09-02 09:52:51 +0000
commit39825fad12d081797d4b06ae27e59709cba61afd (patch)
treee47432c114de5b66e4257efeba8cf9e13160d019
parent67d56cfa0933862ef8c9330a3a0da873c9188a79 (diff)
downloaddrakx-39825fad12d081797d4b06ae27e59709cba61afd.tar
drakx-39825fad12d081797d4b06ae27e59709cba61afd.tar.gz
drakx-39825fad12d081797d4b06ae27e59709cba61afd.tar.bz2
drakx-39825fad12d081797d4b06ae27e59709cba61afd.tar.xz
drakx-39825fad12d081797d4b06ae27e59709cba61afd.zip
new function select_by_package_names()
-rw-r--r--perl-install/install_any.pm7
-rw-r--r--perl-install/install_steps_interactive.pm5
-rw-r--r--perl-install/pkgs.pm9
3 files changed, 12 insertions, 9 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index cf26dba25..d5bc846fc 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -258,10 +258,7 @@ sub setup_postinstall_rpms($$) {
#- compute closure of package that may be copied, use INSTALL category
#- in rpmsrate.
$packages->{rpmdb} ||= pkgs::rpmDbOpen();
- foreach (@{$packages->{needToCopy} || []}) {
- my $p = pkgs::packageByName($packages, $_) or next;
- pkgs::selectPackage($packages, $p, 0, \%toCopy);
- }
+ pkgs::select_by_package_names($packages, $packages->{needToCopy} || [], 0, \%toCopy);
delete $packages->{rpmdb};
my @toCopy = grep { $_ && !$_->flag_selected } map { $packages->{depslist}[$_] } keys %toCopy;
@@ -885,7 +882,7 @@ sub default_packages {
sub select_default_packages {
my ($o) = @_;
- pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
+ pkgs::select_by_package_names($o->{packages}, $o->{default_packages});
}
sub unselectMostPackages {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index cdd1cfebd..2c350ef16 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -504,10 +504,7 @@ The format is the same as auto_install generated files."),
$o->ask_okcancel('', N("Bad file")) or return;
} else {
install_any::unselectMostPackages($o);
- foreach (@{$O->{default_packages} || []}) {
- my $pkg = pkgs::packageByName($packages, $_);
- pkgs::selectPackage($packages, $pkg) if $pkg;
- }
+ pkgs::select_by_package_names($packages, $O->{default_packages} || []);
return 1;
}
}
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 873e965fe..92b07e284 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -279,6 +279,15 @@ sub packageCallbackChoices {
}
}
+sub select_by_package_names {
+ my ($packages, $names, $b_base, $o_otherOnly) = @_;
+
+ foreach (@$names) {
+ my $p = packageByName($packages, $_) or next;
+ selectPackage($packages, $p, $b_base, $o_otherOnly);
+ }
+}
+
#- selection, unselection of package.
sub selectPackage {
my ($packages, $pkg, $b_base, $o_otherOnly) = @_;