summaryrefslogtreecommitdiffstats
path: root/urpmi.update
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-11-13 13:55:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-11-13 13:55:28 +0000
commitfefa3f9d84fa092aada271bb40807a1bc0c6f7e0 (patch)
treec25fb34eb6f5236fcda765df860df8f401b7b542 /urpmi.update
parent2cdcb72bc29a4ddce0991f48fab9af0d57f4945e (diff)
downloadurpmi-fefa3f9d84fa092aada271bb40807a1bc0c6f7e0.tar
urpmi-fefa3f9d84fa092aada271bb40807a1bc0c6f7e0.tar.gz
urpmi-fefa3f9d84fa092aada271bb40807a1bc0c6f7e0.tar.bz2
urpmi-fefa3f9d84fa092aada271bb40807a1bc0c6f7e0.tar.xz
urpmi-fefa3f9d84fa092aada271bb40807a1bc0c6f7e0.zip
- urpmi.update
o updated "ignore"d medium should not become non "ignore"d (#45457) (regression introduced in 6.14.9) the fix is to use update_those_media() which doesn't filter on {ignore} media, and so we don't need to unset {ignore} to allow updating a media setting {modified} is hopefully unneeded when using update_those_media(), but who knows :-/
Diffstat (limited to 'urpmi.update')
-rwxr-xr-xurpmi.update43
1 files changed, 19 insertions, 24 deletions
diff --git a/urpmi.update b/urpmi.update
index 87ef1ebb..abc6e530 100755
--- a/urpmi.update
+++ b/urpmi.update
@@ -73,37 +73,32 @@ urpm::media::read_config($urpm, $options{nocheck});
my @chosen_media;
-if ($options{all} && !defined $options{ignore}) {
- @chosen_media = @{$urpm->{media}}
- or die N("nothing to update (use urpmi.addmedia to add a media)\n");
-} else {
- if ($options{all}) {
- @chosen_media = @{$urpm->{media}};
- } elsif ($options{update}) {
- @chosen_media = grep { $_->{update} } @{$urpm->{media}};
- }
- push @chosen_media, urpm::media::select_media_by_name($urpm, \@cmdline);
+if ($options{all} || $options{update}) {
+ @chosen_media = urpm::media::all_media_to_update($urpm, $options{update});
+}
+push @chosen_media, urpm::media::select_media_by_name($urpm, \@cmdline);
- @chosen_media or die N("the entry to update is missing\n(one of %s)\n", join(", ", map { $_->{name} } @{$urpm->{media}}));
-
- foreach (@chosen_media) {
- $_->{modified} = 1;
+@chosen_media or die $options{all} ?
+ N("nothing to update (use urpmi.addmedia to add a media)\n")
+ : N("the entry to update is missing\n(one of %s)\n", join(", ", map { $_->{name} } @{$urpm->{media}}));
- if ($options{ignore}) {
- $_->{ignore} = 1;
- } else {
- #- force ignored media to be returned alive.
- delete $_->{ignore};
- }
+if (defined $options{ignore}) {
+ foreach (@chosen_media) {
+ if ($options{ignore}) {
+ $_->{ignore} = 1;
+ } else {
+ #- force ignored media to be returned alive.
+ delete $_->{ignore};
+ }
}
-}
-
-if (defined $options{ignore}) {
my $str = join(", ", map { N("\"%s\"", $_->{name}) } @chosen_media);
$urpm->{log}($options{ignore} ? N("ignoring media %s", $str) : N("enabling media %s", $str));
urpm::media::write_config($urpm);
} else {
- my $ok = urpm::media::update_media($urpm, %options,
+ # this is unneeded afaik, keeping just in case it helps
+ $_->{modified} = 1 foreach @chosen_media;
+
+ my $ok = urpm::media::update_those_media($urpm, \@chosen_media, %options,
quiet => $options{verbose} < 0,
callback => \&urpm::download::sync_logger);
#- try to umount removable device which may have been mounted.