summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-08-23 09:09:50 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-08-23 09:09:50 +0000
commit579e0f3b52e2b2fb22350d585265ec02a654ccfa (patch)
tree87af09f6720b6e974e1a1a1acfffd5bdd9de470a /usr.sbin/pkg_add
parent6a0b21045c51c2fdb10860242c223651a256dd3f (diff)
write out the object url in the error message if that's an object error and
not a basic listing repository issue.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 2f01308ec68..d5d6e079a71 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.48 2007/06/23 17:55:12 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.49 2007/08/23 09:09:49 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -121,7 +121,7 @@ sub close
waitpid($object->{pid2}, 0);
alarm(0);
}
- $self->parse_problems($object->{errors}, $hint)
+ $self->parse_problems($object->{errors}, $hint, $object)
if defined $object->{errors};
undef $object->{errors};
$object->deref;
@@ -184,7 +184,7 @@ sub grabPlist
sub parse_problems
{
- my ($self, $filename, $hint) = @_;
+ my ($self, $filename, $hint, $object) = @_;
unlink $filename;
}
@@ -528,10 +528,14 @@ sub grabPlist
sub parse_problems
{
- my ($self, $filename, $hint) = @_;
+ my ($self, $filename, $hint, $object) = @_;
CORE::open(my $fh, '<', $filename) or return;
my $baseurl = $self->url;
+ my $url = $baseurl;
+ if (defined $object) {
+ $url = $object->url;
+ }
local $_;
my $notyet = 1;
while(<$fh>) {
@@ -554,7 +558,7 @@ sub parse_problems
next if m/^421\s+/o;
}
if ($notyet) {
- print STDERR "Error from $baseurl:\n" if $notyet;
+ print STDERR "Error from $url:\n" if $notyet;
$notyet = 0;
}
if (m/^421\s+/o ||
@@ -568,7 +572,7 @@ sub parse_problems
print STDERR $_;
}
CORE::close($fh);
- $self->SUPER::parse_problems($filename, $hint);
+ $self->SUPER::parse_problems($filename, $hint, $object);
}
sub list