diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-01-09 18:02:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-01-09 18:02:00 +0000 |
commit | f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af (patch) | |
tree | fa06b8611be46a41cc5804184d22706e28f96748 /perl-install/standalone.pm | |
parent | c7f44b666d13fda8d4219947d6037fd63f6eaa91 (diff) | |
download | drakx-backup-do-not-use-f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af.tar drakx-backup-do-not-use-f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af.tar.gz drakx-backup-do-not-use-f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af.tar.bz2 drakx-backup-do-not-use-f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af.tar.xz drakx-backup-do-not-use-f1669da7e3a6ce5f267dc5aec5d14f6814a0a6af.zip |
new do_pkgs package which get rid of pkgs_interactive::* which was in install_any
and standalone, and partially duplicated
Diffstat (limited to 'perl-install/standalone.pm')
-rw-r--r-- | perl-install/standalone.pm | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index 5c5162d20..8f8299282 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -146,135 +146,6 @@ Copyright (C) 1999-2003 MandrakeSoft by <install@mandrakesoft.com> } ################################################################################ -package pkgs_interactive; - -use run_program; -use common; -require 'log.pm'; - -our @ISA = qw(); #- tell perl_checker this is a class - -sub interactive::do_pkgs { - my ($in) = @_; - bless { in => $in }, 'pkgs_interactive'; -} - -sub install { - my ($o, @l) = @_; - - return 1 if is_installed($o, @l); - - if ($::testing) { - log::l("i would install packages " . join(' ', @l)); - return 1; - } - - my $wait = $o->{in}->wait_message('', N("Installing packages...")); - $o->{in}->suspend; - log::explanations("installed packages @l"); - my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', '--no-verify-rpm', @l) == 0; - $o->{in}->resume; - $ret; -} - -sub ensure_is_installed { - my ($o, $pkg, $file, $b_auto) = @_; - - if (! -e $file) { - $o->{in}->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) - or return if !$b_auto; - $o->{in}->do_pkgs->install($pkg); - } - if (! -e $file) { - $o->{in}->ask_warn('', N("Mandatory package %s is missing", $pkg)); - return; - } - 1; -} - -sub check_kernel_module_packages { - my ($_o, $base_name, $o_ext_name) = @_; - my ($result, %list, %select); - my @rpm_qa if 0; - - #- initialize only once from rpm -qa output... - @rpm_qa or @rpm_qa = `rpm -qa`; - - eval { - local *_; - require urpm; - my $urpm = urpm->new; - $urpm->read_config(nocheck_access => 1); - foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) { - $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}"); - } - foreach (@{$urpm->{depslist} || []}) { - $_->name eq $o_ext_name and $list{$_->name} = 1; - $_->name =~ /$base_name/ and $list{$_->name} = 1; - } - foreach (@rpm_qa) { - my ($name) = /(.*?)-[^-]*-[^-]*$/ or next; - $name eq $o_ext_name and $list{$name} = 0; - $name =~ /$base_name/ and $list{$name} = 0; - } - }; - if (!$o_ext_name || exists $list{$o_ext_name}) { - eval { - my ($version_release, $ext); - if (c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/) { - $version_release = "$1.$2"; - $ext = $3 ? "-$3" : ""; - exists $list{"$base_name$ext-$version_release"} or die "no $base_name for current kernel"; - $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1; - } else { - #- kernel version is not recognized, what to do ? - } - foreach (@rpm_qa) { - ($ext, $version_release) = /kernel[^\-]*(-smp|-enterprise|-secure)?(?:-([^\-]+))$/; - $list{"$base_name$ext-$version_release"} and $select{"$base_name$ext-$version_release"} = 1; - } - $result = [ keys(%select), if_($o_ext_name, $o_ext_name) ]; - } - } - return $result; -} - -sub what_provides { - my ($_o, $name) = @_; - split('\|', chomp_(run_program::get_stdout('urpmq', $name))); -} - -sub is_installed { - my ($o, $name) = @_; - are_installed($o, $name); -} - -sub are_installed { - my ($_o, @l) = @_; - my @l2; - run_program::run('/bin/rpm', '>', \@l2, '-q', '--qf', "%{name}\n", @l); #- don't care about the return value - intersection(\@l, [ chomp_(@l2) ]); #- can't return directly @l2 since it contains things like "package xxx is not installed" -} - -sub remove { - my ($o, @l) = @_; - my $_wait = $o->{in}->wait_message('', N("Removing packages...")); - $o->{in}->suspend; - log::explanations("removed packages @l"); - my $ret = system('rpm', '-e', @l) == 0; - $o->{in}->resume; - $ret; -} - -sub remove_nodeps { - my ($o, @l) = @_; - remove($o, '--nodeps', @l) == 0; -} - -################################################################################ - - -package standalone; #- stuff will go to special /var/log/explanations file my $standalone_name; |