diff options
Diffstat (limited to 'urpme')
-rw-r--r-- | urpme | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -23,11 +23,15 @@ use strict; use urpm; use urpm::args; use urpm::msg; +use urpm::install; +use urpm::media; +use urpm::select; + $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"; delete @ENV{qw(ENV BASH_ENV IFS CDPATH)}; -our ($root, $test, $parallel, $auto, $matches, $verbose, $usedistrib, $force, $noscripts, $repackage, @l, $bundle, $restricted); +our ($test, $parallel, $auto, $matches, $verbose, $force, $noscripts, $repackage, @l, $bundle, $restricted); # Translator: Add here the keys which might be pressed in the "Yes"-case. my $yesexpr = N("Yy"); @@ -44,10 +48,13 @@ usage: ") . N(" --parallel - distributed urpmi across machines of alias. ") . N(" --repackage - Re-package the files before erasing ") . N(" --root - use another root for rpm removal. +") . N(" --urpmi-root - use another root for urpmi db & rpm installation. ") . N(" --noscripts - do not execute package scriptlet(s). ") . N(" --use-distrib - configure urpme on the fly from a distrib tree, useful to (un)install a chroot with --root option. -") . N(" -v - verbose mode. +") . N(" --probe-synthesis - use synthesis file. +") . N(" --probe-hdlist - use hdlist file. +") . N(" --verbose, -v - verbose mode. ") . N(" -a - select all packages matching expression. "); exit(0); @@ -55,10 +62,10 @@ usage: @ARGV or usage(); my @origARGV = @ARGV; -urpm::args::parse_cmdline() or exit(1); +my $urpm = new urpm; +urpm::args::parse_cmdline(urpm => $urpm) or exit(1); @l = @ARGV; -my $urpm = new urpm; my $state = {}; #- remove verbose if not asked. @@ -70,7 +77,7 @@ if ($< && !$test) { #- rurpme checks if ($restricted) { - urpm::error_restricted($urpm) if $root || $usedistrib || $noscripts || $parallel; + urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $noscripts || $parallel; } unless ($test) { @@ -78,15 +85,16 @@ unless ($test) { } #- just configure parallel mode if available. -$urpm->configure( +my $_urpmi_lock = urpm::lock::urpmi_db($urpm); +urpm::media::configure($urpm, synthesis => ($parallel ? 'none' : ''), - root => $root, parallel => $parallel, - usedistrib => $usedistrib, + probe_with => $options{probe_with}, + usedistrib => $options{usedistrib}, ); #- examine packages... -my @toremove = $urpm->find_packages_to_remove( +my @toremove = urpm::select::find_packages_to_remove($urpm, $state, \@l, matches => $matches, @@ -109,10 +117,9 @@ my @toremove = $urpm->find_packages_to_remove( #- Warning : the following message is parsed in urpm::parallel_* $urpm->{error}(N("removing package %s will break your system", $_)); } 0 }, - root => $root, ) or $urpm->{fatal}(0, N("Nothing to remove")); -my $list = $urpm->translate_why_removed($state, @toremove); +my $list = urpm::select::translate_why_removed($urpm, $state, @toremove); if ($test && $auto) { #- Warning : the following message is parsed in urpm::parallel_* my $msg = N("Checking to remove the following packages"); @@ -124,25 +131,23 @@ if ($test && $auto) { } my $msg = N("To satisfy dependencies, the following %d packages will be removed (%d MB)", scalar(@toremove), toMb($sum)); print STDOUT "$msg:\n$list\n"; - message_input(N("Remove %d packages?", scalar(@toremove)) . N(" (y/N) "), $force && $yesexpr, boolean => 1) =~ /[$yesexpr]/ or exit 0; + message_input(P("Remove %d package?", "Remove %d packages?", scalar(@toremove), scalar(@toremove)) . N(" (y/N) "), $force && $yesexpr, boolean => 1) =~ /[$yesexpr]/ or exit 0; } #- Warning : the following message is parsed in urpm::parallel_* print N("removing %s", join(' ', sort @toremove)) . "\n"; @l = $parallel - ? $urpm->parallel_remove( + ? urpm::parallel::remove($urpm, \@toremove, test => $test, force => $force, - translate_message => 1, noscripts => $noscripts, repackage => $repackage || $urpm->{options}{repackage}, ) - : $urpm->install( + : urpm::install::install($urpm, \@toremove, {}, {}, test => $test, force => $force, - translate_message => 1, noscripts => $noscripts, repackage => $repackage || $urpm->{options}{repackage}, ); |