From fcf2dda77899ae72517d0d24b911039b96a000b8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 21 Jul 2004 01:36:36 +0000 Subject: - do_pkgs_standalone->new doesn't *need* a $in anymore - ->in replace ->{in} so that it can be created on demand (ugly, but...) --- perl-install/do_pkgs.pm | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/perl-install/do_pkgs.pm b/perl-install/do_pkgs.pm index f9dd64a1c..005e61c9a 100644 --- a/perl-install/do_pkgs.pm +++ b/perl-install/do_pkgs.pm @@ -9,21 +9,16 @@ sub do_pkgs { package do_pkgs_common; use common; -sub new { - my ($type, $in) = @_; - bless { in => $in }, $type; -} - sub ensure_is_installed { my ($do, $pkg, $o_file, $b_auto) = @_; if (! $o_file || ! -e "$::prefix$o_file") { - $do->{in}->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) + $do->in->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return if !$b_auto; $do->install($pkg) or return; } if ($o_file && ! -e "$::prefix$o_file") { - $do->{in}->ask_warn('', N("Mandatory package %s is missing", $pkg)); + $do->in->ask_warn('', N("Mandatory package %s is missing", $pkg)); return; } 1; @@ -54,6 +49,11 @@ sub new { bless { in => $in, o => $::o }, $type; } +sub in { + my ($do) = @_; + $do->{in}; +} + sub install { my ($do, @l) = @_; log::l("do_pkgs_during_install::install"); @@ -130,6 +130,20 @@ use log; our @ISA = qw(do_pkgs_common); +sub new { + my ($type, $o_in) = @_; + bless { in => $o_in }, $type; +} + +sub in { + my ($do) = @_; + $do->{in} ||= do { + require interactive; + interactive->vnew; + }; + $do->{in}; +} + sub install { my ($do, @l) = @_; @@ -140,11 +154,11 @@ sub install { return 1; } - my $_wait = $do->{in}->wait_message('', N("Installing packages...")); - $do->{in}->suspend; + my $_wait = $do->in->wait_message('', N("Installing packages...")); + $do->in->suspend; log::explanations("installed packages @l"); my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', '--no-verify-rpm', @l) == 0; - $do->{in}->resume; + $do->in->resume; $ret; } @@ -214,11 +228,11 @@ sub are_installed { sub remove { my ($do, @l) = @_; - my $_wait = $do->{in}->wait_message('', N("Removing packages...")); - $do->{in}->suspend; + my $_wait = $do->in->wait_message('', N("Removing packages...")); + $do->in->suspend; log::explanations("removed packages @l"); my $ret = system('rpm', '-e', @l) == 0; - $do->{in}->resume; + $do->in->resume; $ret; } -- cgit v1.2.1