summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2020-02-19 14:22:29 +0000
committerespie <espie@openbsd.org>2020-02-19 14:22:29 +0000
commit5781d5039ee98d41c035879c2a554e15d1699605 (patch)
tree04b40883f93bbd271c8ded906ac84aec1bdfb8e6 /usr.sbin/pkg_add
parentFix http (not https) auth combined with proxy auth. (diff)
downloadwireguard-openbsd-5781d5039ee98d41c035879c2a554e15d1699605.tar.xz
wireguard-openbsd-5781d5039ee98d41c035879c2a554e15d1699605.zip
allow search objects to say "keep_all" and make PackageRepositoryLists
aware of that for match_locations
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm9
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Search.pm9
2 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
index 8dd5483295c..ac5de0718d4 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepositoryList.pm,v 1.31 2017/05/29 12:28:54 espie Exp $
+# $OpenBSD: PackageRepositoryList.pm,v 1.32 2020/02/19 14:22:29 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -80,13 +80,16 @@ sub grabPlist
sub match_locations
{
my ($self, @search) = @_;
+ my $result = [];
for my $repo (@{$self->{l}}) {
my $l = $repo->match_locations(@search);
- if (@$l > 0) {
+ if ($search[0]->{keep_all}) {
+ push(@$result, @$l);
+ } elsif (@$l > 0) {
return $l;
}
}
- return [];
+ return $result;
}
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm
index 0f80290f41b..d9da595a318 100644
--- a/usr.sbin/pkg_add/OpenBSD/Search.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Search.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Search.pm,v 1.30 2018/04/25 09:45:30 espie Exp $
+# $OpenBSD: Search.pm,v 1.31 2020/02/19 14:22:29 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -28,6 +28,13 @@ sub match_locations
return \@l;
}
+sub keep_all
+{
+ my $self = shift;
+ $self->{keep_all} = 1;
+ return $self;
+}
+
package OpenBSD::Search::PkgSpec;
our @ISA=(qw(OpenBSD::Search));