summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2017-03-07 14:19:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2017-03-07 14:19:33 +0000
commit8c5322298169b790e1197c6c6f8236770111d954 (patch)
treeb10ecc11063ba9ba916ff1514c30e33383b4ae76
parentd4d06da13bdc23b57dec6dc5e3661a9fb5912d39 (diff)
more error streamlining:
- if we don't have an object for fetch, then we're grabbing a list for http "not found" means it's not a proper package directory. - report once for "empty" repositories, and we know the difference between an empty dir and a non existing directory - if we have an object, save we already reported an error to avoiding cascading error reports
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm29
1 files changed, 16 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 19847dc3a31..9b5fd67a486 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.140 2017/02/06 16:12:16 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.141 2017/03/07 14:19:32 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -157,7 +157,8 @@ sub stemlist
require OpenBSD::PackageName;
my @l = $self->available;
if (@l == 0 && !$self->{empty_okay}) {
- $self->{state}->errsay("#1 is empty", $self->url);
+ $self->{state}->errsay("#1: #2", $self->url,
+ $self->{no_such_dir} ? "no such dir" : "empty");
}
$self->{stemlist} = OpenBSD::PackageName::avail2stems(@l);
}
@@ -299,6 +300,15 @@ sub parse_problems
$broken = 1;
next;
}
+ # http error
+ if (m/^ftp: Error retrieving file: 404/o) {
+ if (!defined $object) {
+ $self->{no_such_dir} = 1;
+ next;
+ } else {
+ $self->{lasterror} = 404;
+ }
+ }
if (defined $hint && $hint == 0) {
next if m/^ftp: -: short write/o;
@@ -306,7 +316,10 @@ sub parse_problems
next if m/^421\s+/o;
}
if ($notyet) {
- $self->{state}->errsay("Error from #1", $url);
+ $self->{state}->errprint("#1: ", $url);
+ if (defined $object) {
+ $object->{error_reported} = 1;
+ }
$notyet = 0;
}
if (m/^signify:/) {
@@ -318,10 +331,6 @@ sub parse_problems
m/^ftp: Can't connect or login to host/o) {
$self->{lasterror} = 421;
}
- # http error
- if (m/^ftp: Error retrieving file: 404/o) {
- $self->{lasterror} = 404;
- }
if (m/^550\s+/o) {
$self->{lasterror} = 550;
}
@@ -868,12 +877,6 @@ sub list
}
$self->{list} = $self->obtain_list($error);
$self->parse_problems($error);
- if ($self->{no_such_dir}) {
- $self->{state}->errsay(
- "#1: Directory does not exist on #2",
- $self->{path}, $self->{host});
- $self->{lasterror} = 404;
- }
}
return $self->{list};
}