summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-04 13:44:42 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-04 13:44:42 +0000
commitdd207efc048dbd9e7faa7ed106f564232c31a7c7 (patch)
tree2a1121fc3f85a6a0fa1a6782814a53d537ac6be9
parent39ea4236f990210b8a15dd65e59841900561cfb9 (diff)
downloadurpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.gz
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.bz2
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.tar.xz
urpmi-dd207efc048dbd9e7faa7ed106f564232c31a7c7.zip
handle priority upgrade list
-rw-r--r--NEWS2
-rw-r--r--gurpmi.pm3
-rwxr-xr-xgurpmi221
-rw-r--r--urpm/args.pm2
4 files changed, 25 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index c30a102d..8d8b61fc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- add infrastructure so that gurpmi & rpmdrake can handle priority
upgrade list
+- gurpmi:
+ o handle priority upgrade list
Version 5.7 - 3 March 2008, by Pascal "Pixel" Rigaux
diff --git a/gurpmi.pm b/gurpmi.pm
index b9c3636f..5a882d8b 100644
--- a/gurpmi.pm
+++ b/gurpmi.pm
@@ -23,11 +23,14 @@ use Gtk2;
use urpm::util;
use urpm::msg;
use urpm::args;
+use urpm::select;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(create_scrolled_window fatal but quit add_button_box new_label N);
+urpm::select::add_packages_to_priority_upgrade_list('gurpmi');
+
sub usage () {
print <<USAGE;
gurpmi version $urpm::VERSION
diff --git a/gurpmi2 b/gurpmi2
index 2b6bed4b..64723936 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -77,11 +77,15 @@ my %requested = $urpm->register_rpms(@all_rpms);
if (@gurpmi::names) {
urpm::select::search_packages($urpm, \%requested, [ @gurpmi::names ]);
}
-urpm::select::resolve_dependencies($urpm,
+
+#- return value is true if program should be restarted (in order to take care of important
+#- packages being upgraded (problably urpmi and perl-URPM, but maybe rpm too, and glibc also ?).
+my $restart_itself = urpm::select::resolve_dependencies($urpm,
$state,
\%requested,
callback_choices => \&ask_choice,
auto_select => $::auto_select,
+ priority_upgrade => $urpm->{options}{'priority-upgrade'},
);
my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
@ask_unselect
@@ -126,6 +130,7 @@ sub configure_urpm() {
$w->run;
$w->destroy;
};
+ urpm::select::set_priority_upgrade_option($urpm, $gurpmi::options{previous_priority_upgrade})
$rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive');
$urpmi_lock = urpm::lock::urpmi_db($urpm);
urpm::media::configure($urpm,
@@ -254,7 +259,7 @@ sub do_install_3 () {
sync();
};
- urpm::main_loop::run($urpm, $state, scalar(@gurpmi::names), \@ask_unselect, \%requested, {
+ my $exit_code = urpm::main_loop::run($urpm, $state, scalar(@gurpmi::names), \@ask_unselect, \%requested, {
bad_signature => sub {
my ($msg, $msg2) = @_;
ask_continue_blocking("$msg\n$msg2");
@@ -318,4 +323,16 @@ sub do_install_3 () {
trans => $callback_inst,
}
);
+
+ #- restart gurpmi if needed, keep command line for that.
+ if ($restart_itself && !$exit_code) {
+ print N("restarting urpmi"), "\n";
+ #- it seems to work correctly with exec instead of system, provided
+ #- added --previous-priority-upgrade to allow checking if yet if
+ #- priority-upgrade list has changed. and make sure we don't uselessly restart
+ @ARGV = ('--previous-priority-upgrade=' . $urpm->{options}{'priority-upgrade'},
+ grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @ARGV);
+ exec $0, @ARGV;
+ }
+
}
diff --git a/urpm/args.pm b/urpm/args.pm
index 5477a8ca..120118a2 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -370,7 +370,7 @@ sub add_urpmf_parameter {
# common options setup
-foreach my $k ('allow-medium-change', 'auto', 'auto-select', 'expect-install!', 'root=s', 'test!', 'verify-rpm!')
+foreach my $k ('allow-medium-change', 'auto', 'auto-select', 'expect-install!', 'no-priority-upgrade', 'previous-priority-upgrade=s', 'root=s', 'test!', 'verify-rpm!')
{
$options_spec{gurpmi}{$k} = $options_spec{urpmi}{$k};
}