summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-12-05 16:16:52 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-12-05 16:16:52 +0000
commitc1314b9fdbea88d3d2e2f53fa3344f996e663d8c (patch)
tree035b51f2414906a32043b004566554aeaa4bcfb3
parenta9def5f61d5a49e5f148951af4e422c446b57c84 (diff)
downloadurpmi-c1314b9fdbea88d3d2e2f53fa3344f996e663d8c.tar
urpmi-c1314b9fdbea88d3d2e2f53fa3344f996e663d8c.tar.gz
urpmi-c1314b9fdbea88d3d2e2f53fa3344f996e663d8c.tar.bz2
urpmi-c1314b9fdbea88d3d2e2f53fa3344f996e663d8c.tar.xz
urpmi-c1314b9fdbea88d3d2e2f53fa3344f996e663d8c.zip
- urpmi.update:
o exit code 1 when a (selected) medium can't be updated (#35952) o leave early with error if no medium were successfull updated nb: also fix returning "unmodified" instead of "1" when a medium is not updated
-rw-r--r--NEWS3
-rw-r--r--urpm/media.pm15
-rwxr-xr-xurpmi.update3
3 files changed, 17 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index e6f47105..42cd1baf 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- urpmi.update:
+ o exit code 1 when a (selected) medium can't be updated (#35952)
+ o leave early with error if no medium were successfull updated
- drop translated man pages (they are too old)
- urpmi.addmedia:
o enhance parsing of urls with login:password for logins with "@"
diff --git a/urpm/media.pm b/urpm/media.pm
index 9cd588cb..c262900d 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -1595,7 +1595,7 @@ sub _update_medium_first_pass {
#- to speed up the process, we only read the synthesis at the beginning.
_parse_hdlist_or_synthesis__when_not_modified($urpm, $medium);
compute_need_second_pass($urpm, $medium, \@unresolved_before);
- return 1;
+ return 'unmodified';
}
#- always delete a remaining list file or pubkey file in cache.
@@ -1801,9 +1801,16 @@ sub update_media {
_update_media__handle_some_flags($urpm, $options{forcekey}, $options{all});
my $clean_cache = !$options{noclean};
+ my %updates_result;
foreach my $medium (grep { !$_->{ignore} } @{$urpm->{media}}) {
- _update_medium_first_pass($urpm, $medium, \$clean_cache, %options)
- or _update_medium_first_pass_failed($urpm, $medium);
+ my $rc = _update_medium_first_pass($urpm, $medium, \$clean_cache, %options);
+ $updates_result{$rc || 'error'}++;
+ $rc or _update_medium_first_pass_failed($urpm, $medium);
+ }
+
+ if ($updates_result{1} == 0) {
+ #- only errors/unmodified, leave now
+ return $updates_result{error} == 0;
}
#- some unresolved provides may force to rebuild all synthesis,
@@ -1846,6 +1853,8 @@ sub update_media {
#- NB: in case of $urpm->{modified}, write_MD5SUM is called in write_config above
write_MD5SUM($urpm);
}
+
+ $updates_result{error} == 0;
}
#- clean params and depslist computation zone.
diff --git a/urpmi.update b/urpmi.update
index 9d6357e2..9de870e2 100755
--- a/urpmi.update
+++ b/urpmi.update
@@ -101,9 +101,10 @@ if (defined $options{ignore}) {
$urpm->{log}($options{ignore} ? N("ignoring media %s", $str) : N("enabling media %s", $str));
urpm::media::write_config($urpm);
} else {
- urpm::media::update_media($urpm, %options,
+ my $ok = urpm::media::update_media($urpm, %options,
quiet => $options{verbose} < 0,
callback => \&urpm::download::sync_logger);
#- try to umount removable device which may have been mounted.
urpm::removable::try_umounting_removables($urpm);
+ exit $ok ? 0 : 1;
}