summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-02-27 20:49:36 +0000
committerThierry Vignaud <tv@mageia.org>2012-02-27 20:49:36 +0000
commit72c315d0ff18010dd13c32a0b1b41d4a06f20686 (patch)
tree50292efc82e104acb184fb3365ec5621b5470b7b
parent5e8cc5185a12d7d46034c10b214a97b5b9b96eee (diff)
downloadurpmi-72c315d0ff18010dd13c32a0b1b41d4a06f20686.tar
urpmi-72c315d0ff18010dd13c32a0b1b41d4a06f20686.tar.gz
urpmi-72c315d0ff18010dd13c32a0b1b41d4a06f20686.tar.bz2
urpmi-72c315d0ff18010dd13c32a0b1b41d4a06f20686.tar.xz
urpmi-72c315d0ff18010dd13c32a0b1b41d4a06f20686.zip
urpmq: fix non-zero exit code if .rpm file was not found (POK, mdv#64969)
-rw-r--r--NEWS2
-rw-r--r--urpm/args.pm5
-rwxr-xr-xurpmq15
3 files changed, 14 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 04affc24..cdffe9e8 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@
o --test: do not update /var/lib/rpm/installed-through-deps.list
- urpmi.addmedia:
o fix $ARCH and $VERSION keyword substition in media URL
+- urpmq:
+ o non-zero exit code if .rpm file was not found (POK, mdv#64969)
Version 6.44 - 07 February 2012
diff --git a/urpm/args.pm b/urpm/args.pm
index aa7b0d79..c66db9de 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -303,7 +303,10 @@ my %options_spec = (
my $x = $_[0];
if ($x =~ /\.rpm$/) {
if (-r $x) { push @::files, $x }
- else { print STDERR N("urpmq: cannot read rpm file \"%s\"\n", $x) }
+ else {
+ print STDERR N("urpmq: cannot read rpm file \"%s\"\n", $x);
+ $urpm::postponed_code = 1;
+ }
} elsif ($x =~ /^--?(.+)/) { # unrecognized option
die "Unknown option: $1\n";
} else {
diff --git a/urpmq b/urpmq
index 78f2142d..3a271526 100755
--- a/urpmq
+++ b/urpmq
@@ -160,7 +160,7 @@ if ($options{auto_orphans}) {
require urpm::orphans;
my $orphans = urpm::orphans::get_orphans($urpm);
print "$_\n" foreach sort map { $pkg_to_string->($_) } @$orphans;
- exit 0;
+ exit $urpm::postponed_code;
}
if ($options{env}) {
@@ -212,14 +212,14 @@ if ($options{list_aliases}) {
foreach (keys %{$urpm->{parallel_handler}{nodes} || {}}) {
print "$_\n";
}
- exit 0;
+ exit $urpm::postponed_code;
} elsif ($options{list_media} || $options{list_url}) {
foreach (@{$urpm->{media}}) {
next if $options{list_media} eq 'update' && !$_->{update};
next if $options{list_media} eq 'active' && $_->{ignore};
print $_->{name} . ($options{list_url} ? " $_->{url}" : "") . "\n";
}
- exit 0;
+ exit $urpm::postponed_code;
} elsif ($options{dump_config}) {
foreach (@{$urpm->{media}}) {
$_->{update} and print "--update ";
@@ -230,7 +230,7 @@ if ($options{list_aliases}) {
$_->{with_synthesis} and print "with " . escape_shell($_->{with_synthesis});
print "\n";
}
- exit 0;
+ exit $urpm::postponed_code;
} elsif ($options{list}) {
!@names && !@src_names or $urpm->{fatal}(1, N("use -l to list files"));
@@ -502,7 +502,7 @@ if ($options{list_aliases}) {
print "$_\n" foreach values %$local_sources;
print "$_\n" foreach map { urpm::blist_to_urls($_) } @$blists;
}
- exit 0;
+ exit $urpm::postponed_code;
} elsif ($options{summary}) {
foreach (keys %{$state->{selected}}) {
foreach (split /\|/, $_) {
@@ -510,7 +510,7 @@ if ($options{list_aliases}) {
printf "%s : %s ( %s%s-%s )\n", $pkg->name, $pkg->summary, ($pkg->epoch ? $pkg->epoch . ':' : ''), $pkg->version, $pkg->release;
}
}
- exit 0;
+ exit $urpm::postponed_code;
} elsif (my ($get) = grep { $options{$_} } 'provides', 'requires', 'conflicts', 'obsoletes', 'suggests') {
my @l = uniq_ { scalar $_->fullname } map { $urpm->{depslist}[$_] } map { split /\|/, $_ } keys %{$state->{selected}};
foreach my $pkg (@l) {
@@ -520,7 +520,7 @@ if ($options{list_aliases}) {
print "$_\n" foreach $pkg->$get;
}
}
- exit 0;
+ exit $urpm::postponed_code;
}
}
$urpmi_lock and $urpmi_lock->unlock;
@@ -562,3 +562,4 @@ foreach my $id (sort { eval { $urpm->{depslist}[$a]->name cmp $urpm->{depslist}[
}
}
+exit $urpm::postponed_code;