summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-07-02 12:41:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-07-02 12:41:44 +0000
commit135b3b363dcc2fbd6a00adfda944be0f02b3a189 (patch)
treeed502b48dec3050ed58e540ec9751df3a7450418 /usr.sbin
parentcc11bc67b069885b8c97d362c3c6db88399a56ef (diff)
move the empty url message up to PackageRepository, so that we can print
it cleanly. allow some urls to be empty without warning (e.g., "./" should generally be allowed to be empty).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm16
2 files changed, 14 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index 303d5558f72..28f217e3c04 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageName.pm,v 1.47 2010/06/30 10:51:04 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.48 2010/07/02 12:41:43 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -105,9 +105,6 @@ sub compile_stemlist
sub avail2stems
{
my @avail = @_;
- if (@avail == 0) {
- print STDERR "No packages available in the PKG_PATH\n";
- }
return OpenBSD::PackageName::compile_stemlist(@avail);
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 4a2879653e5..dda5a0fdd28 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.85 2010/07/02 11:44:14 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.86 2010/07/02 12:41:43 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -47,6 +47,13 @@ sub new
return $o;
}
+sub can_be_empty
+{
+ my $self = shift;
+ $self->{empty_okay} = 1;
+ return $self;
+}
+
my $cache = {};
sub unique
@@ -131,8 +138,11 @@ sub stemlist
my $self = shift;
if (!defined $self->{stemlist}) {
require OpenBSD::PackageName;
-
- $self->{stemlist} = OpenBSD::PackageName::avail2stems($self->available);
+ my @l = $self->available;
+ if (@l == 0 && !$self->{empty_okay}) {
+ $self->{state}->errsay("#1 is empty", $self->url);
+ }
+ $self->{stemlist} = OpenBSD::PackageName::avail2stems(@l);
}
return $self->{stemlist};
}