From acbc56d621004e5ea6588391f9822dfc4347a8fe Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 30 Jul 2009 13:15:58 +0000 Subject: dudf patch from Olivier Rosello for the Mancoosi project --- urpmi | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'urpmi') diff --git a/urpmi b/urpmi index f61d4b5b..fdf1227a 100755 --- a/urpmi +++ b/urpmi @@ -52,6 +52,7 @@ our $logfile = ''; our $restricted = 0; our $nomd5sum = 0; our $forcekey = 0; +our $force_dudf = 0; my @files; my @src_files; @@ -63,6 +64,14 @@ delete @ENV{qw(ENV BASH_ENV IFS CDPATH)}; $ENV{HOME} ||= "/root"; $ENV{USER} ||= "root"; +sub dudf_invoke { + my ($dudf, $methodname, @args) = @_; + + if ($dudf) { + $dudf->$methodname($dudf, @args); + } +} + sub usage () { print N("urpmi version %s Copyright (C) 1999-2008 Mandriva. @@ -178,6 +187,12 @@ if (member('--restricted', @ARGV)) { } my $urpm = urpm->new_parse_cmdline or exit(1); +my $dudf; + +eval { + require urpm::dudf; + $dudf = new urpm::dudf(\$urpm, $command_line, $force_dudf); +}; if (@ARGV && $auto_select) { print STDERR N("Error: can't use --auto-select along with package list.\n"); @@ -380,6 +395,8 @@ if ($bug) { my $rpm_lock = !$env && !$options{nolock} && urpm::lock::rpm_db($urpm, 'exclusive', wait => $options{wait_lock}); +dudf_invoke($dudf, "store_userpkgs", @names); + #- search the packages according to the selection given by the user. my $search_result = ''; if (@names) { @@ -512,6 +529,8 @@ if (@ask_unselect) { } } + my $msg = N("The installation cannot continue because the following package has to be removed for others to be upgraded:\n%s\n"); + if (my @conflicting_pkgs_msgs = $urpm->{options}{'allow-force'} ? () : urpm::select::removed_packages_msgs($urpm, $state)) { { @@ -532,6 +551,7 @@ has to be removed for others to be upgraded:\n%s\n", $list) : N("The installation cannot continue because the following packages have to be removed for others to be upgraded:\n%s\n", $list); print "$msg\n"; + dudf_invoke($dudf, "dudf_exit", 0, $msg); exit 0; } @@ -564,7 +584,6 @@ my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selecte } } - if (@to_install && $options{auto_orphans}) { urpm::orphans::compute_future_unrequested_orphans($urpm, $state); if (my @orphans = map { scalar $_->fullname } @{$state->{orphans_to_remove}}) { @@ -589,6 +608,9 @@ foreach my $pkg (@to_install) { $ask_user ||= !$pkg->flag_requested || $auto_select || $parallel; } $urpm->{nb_install} = @to_install; + +dudf_invoke($dudf, "store_toinstall", @to_install); + if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$options{debug__do_not_install}) { my $msg = $urpm->{nb_install} == 1 ? N("To satisfy dependencies, the following package is going to be installed:") : N("To satisfy dependencies, the following packages are going to be installed:"); @@ -614,6 +636,8 @@ if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$opt $force || message_input_($p . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 0; } +dudf_invoke($dudf, "check_removed_upgraded", $state); + my $exit_code = urpm::main_loop::run($urpm, $state, int(@names || @src_names || @files || @src_files), \@ask_unselect, \%requested, { @@ -709,4 +733,6 @@ if ($pid_err || $pid_out) { close STDOUT; } +dudf_invoke($dudf, "dudf_exit", $exit_code); + exit($exit_code); -- cgit v1.2.1