summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-28 11:51:27 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-28 11:51:27 +0000
commit6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0 (patch)
tree87f257079174e32f931205733ed1d97d20fad035
parent13258c86d966b9bf5abd71a4a892a2c7350d7ff0 (diff)
downloadurpmi-6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0.tar
urpmi-6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0.tar.gz
urpmi-6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0.tar.bz2
urpmi-6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0.tar.xz
urpmi-6dc554230ca73e99fbc1ac5fdd2a3ccd0c9f32e0.zip
- urpmi
o handle changes in priority-upgrade list between old and new urpmi (#32925) nb: keep --no-priority-upgrade since it is passed by older urpmi when restarting
-rw-r--r--NEWS1
-rw-r--r--urpm/args.pm6
-rw-r--r--urpm/select.pm19
-rwxr-xr-xurpmi16
4 files changed, 33 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index f52a68a7..3f56fbd9 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
o fix --bug when there is no /etc/urpmi/prefer.list file
o new option --justdb (new perl-URPM 1.76)
o do not verify signature of .spec files (#32824)
+ o handle changes in priority-upgrade list between old and new urpmi (#32925)
- urpmf
o display "usage" when no <pattern-expression> is given (#32658)
diff --git a/urpm/args.pm b/urpm/args.pm
index adbb49d9..47dbb1e2 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -92,8 +92,12 @@ my %options_spec = (
'pre-clean!' => sub { $urpm->{options}{'pre-clean'} = $_[1] },
'post-clean!' => sub { $urpm->{options}{'post-clean'} = $_[1] },
'no-priority-upgrade' => sub {
- $urpm->{options}{'priority-upgrade'} = '';
+ #- keep this option which is passed by older urpmi.
+ #- since we can't know what the previous_priority_upgrade list was,
+ #- just use a rubbish value which will mean list has changed
+ $options{previous_priority_upgrade} = 'list_has_changed';
},
+ 'previous-priority-upgrade=s' => \$options{previous_priority_upgrade},
force => \$::force,
justdb => \$options{justdb},
replacepkgs => \$options{replacepkgs},
diff --git a/urpm/select.pm b/urpm/select.pm
index 0300395e..fd57be04 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -7,6 +7,25 @@ use urpm::util;
use urpm::sys;
use URPM;
+sub set_priority_upgrade_option {
+ my ($urpm, $previous) = @_;
+
+ exists $urpm->{options}{'priority-upgrade'} and return;
+
+ # comma-separated list of packages that should be installed first,
+ # and that trigger an urpmi restart
+ my $list = 'rpm,perl-URPM,perl-MDV-Distribconf,urpmi,meta-task,glibc';
+ if ($previous) {
+ if ($previous eq $list) {
+ $list = '';
+ $urpm->{log}(N("urpmi was restarted, and the list of priority packages did not change"));
+ } else {
+ $urpm->{log}(N("urpmi was restarted, and the list of priority packages did change: %s vs %s", $previous, $list));
+ }
+ }
+ $urpm->{options}{'priority-upgrade'} = $list;
+}
+
sub _findindeps {
my ($urpm, $found, $qv, $v, $caseinsensitive, $src) = @_;
diff --git a/urpmi b/urpmi
index 6caf4ee1..998d351f 100755
--- a/urpmi
+++ b/urpmi
@@ -322,8 +322,8 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
select STDERR; $| = 1;
select STDOUT; $| = 1;
-if (exists $urpm->{options}{'priority-upgrade'} && $urpm->{options}{'priority-upgrade'} eq '') {
- # we were run with --no-priority-upgrade (we were just restarted.)
+if ($options{previous_priority_upgrade}) {
+ # we were just restarted
# so, no need to update the media again
$auto_update = 0;
# temporary hack : if we were using an old version of URPM (eg: when
@@ -387,10 +387,7 @@ if ($bug) {
#- get back activated default values of boolean options.
exists $urpm->{options}{'split-level'} or $urpm->{options}{'split-level'} = $split_level;
exists $urpm->{options}{'split-length'} or $urpm->{options}{'split-length'} = $split_length;
-# comma-separated list of packages that should be installed first,
-# and that trigger an urpmi restart
-exists $urpm->{options}{'priority-upgrade'}
- or $urpm->{options}{'priority-upgrade'} = 'rpm,perl-URPM,perl-MDV-Distribconf,urpmi,meta-task,glibc';
+urpm::select::set_priority_upgrade_option($urpm, $options{previous_priority_upgrade});
my $state = {};
my %requested = $urpm->register_rpms(@files, @src_files);
@@ -677,14 +674,17 @@ if ($restart_itself && !$exit_code) {
print N("restarting urpmi"), "\n";
#- it seems to work correctly with exec instead of system, provided
#- STDOUT or STDERR are not closed before (else no output at all).
- #- added --no-priority-upgrade to make sure no restart will be done after this one.
+ #- added --previous-priority-upgrade to allow checking if yet if
+ #- priority-upgrade list has changed. and make sure we don't uselessly restart
#- renamed bug report dir as /restarted to avoid exit because it already exists
#- This permits to have in a same dir bug reports before and after the restart
@ARGV = @ARGVcopy;
my @arg = ($ARGV[0], map {
$ARGV[$_] . ($ARGV[$_ - 1] eq '--bug' ? "/restarted" : "");
} (1 .. $#ARGV));
- exec $0, '--no-priority-upgrade', @arg;
+ @arg = ('--previous-priority-upgrade=' . $urpm->{options}{'priority-upgrade'},
+ grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @arg);
+ exec $0, @arg;
}
#- this help flushing correctly by closing this file before (piped on tee).