summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-07-02 12:12:59 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-07-02 12:12:59 +0000
commitf2f9870bac6d779cfdb25ccb7e8a9be09287ca61 (patch)
tree01848f993d2bb0cf88dfa56bbb034aaa9ee2d8ec
parent1ad6c9aa9f5a39e8646246bc2a2dc0df1af1a0e1 (diff)
allows .libs* packages to match correctly in the presence of @conflict markers
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCfl.pm9
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgSpec.pm34
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Search.pm8
3 files changed, 47 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
index 483983aefbb..57783b1d2bd 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCfl.pm,v 1.36 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: PkgCfl.pm,v 1.37 2011/07/02 12:12:58 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -35,7 +35,6 @@ sub make_conflict_list
} else {
push(@$l, OpenBSD::Search::Exact->new("$pkgname|partial-$pkgname"));
}
- push(@$l, OpenBSD::Search::PkgSpec->new(".libs-$stem-*"));
if (defined $plist->{conflict}) {
for my $cfl (@{$plist->{conflict}}) {
push(@$l, $cfl->spec);
@@ -47,10 +46,13 @@ sub make_conflict_list
sub conflicts_with
{
my ($self, @pkgnames) = @_;
+ my @libs = grep {/^\.libs\d*\-/} @pkgnames;
+ @pkgnames = grep {!/^\.libs\d*\-/} @pkgnames;
if (wantarray) {
my @l = ();
for my $cfl (@$self) {
push(@l, $cfl->filter(@pkgnames));
+ push(@l, $cfl->filter_libs(@libs));
}
return @l;
} else {
@@ -58,6 +60,9 @@ sub conflicts_with
if ($cfl->filter(@pkgnames)) {
return 1;
}
+ if ($cfl->filter_libs(@libs)) {
+ return 1;
+ }
}
return 0;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
index 4ba2a7de820..8a65d7ec442 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgSpec.pm,v 1.35 2011/06/30 12:54:44 espie Exp $
+# $OpenBSD: PkgSpec.pm,v 1.36 2011/07/02 12:12:58 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -109,6 +109,11 @@ sub match_ref
return ();
}
+sub match_libs_ref
+{
+ return ();
+}
+
sub match_locations
{
return [];
@@ -239,6 +244,7 @@ sub new
my $o = bless {
exactstem => qr{^$stemspec$},
fuzzystem => qr{^$stemspec\-\d.*$},
+ libstem => qr{^\.libs\d*\-$stemspec\-\d.*$},
constraints => $constraints,
}, $class;
if (defined $r->{e}) {
@@ -272,6 +278,13 @@ LOOP1:
return @result;
}
+sub match_libs_ref
+{
+ my ($o, $list) = @_;
+ return grep(/$o->{libstem}/, @$list);
+}
+
+
sub match_locations
{
my ($o, $list) = @_;
@@ -329,6 +342,25 @@ sub match_ref
}
}
+sub match_libs_ref
+{
+ my ($self, $r) = @_;
+ if (wantarray) {
+ my @l = ();
+ for my $subpattern (@$self) {
+ push(@l, $subpattern->match_libs_ref($r));
+ }
+ return @l;
+ } else {
+ for my $subpattern (@$self) {
+ if ($subpattern->match_libs_ref($r)) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+}
+
sub match_locations
{
my ($self, $r) = @_;
diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm
index 6bbfcdde0b3..ef29cc7fdbf 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.26 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: Search.pm,v 1.27 2011/07/02 12:12:58 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -37,6 +37,12 @@ sub filter
return $self->{spec}->match_ref(\@list);
}
+sub filter_libs
+{
+ my ($self, @list) = @_;
+ return $self->{spec}->match_libs_ref(\@list);
+}
+
sub match_locations
{
my ($self, $o) = @_;