diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-12-28 12:55:04 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-12-28 12:55:04 +0000 |
commit | c798cccb6b32813001d083c387db4aba1a75550b (patch) | |
tree | b047252780d963a46a3716f918a5d74750660c6f | |
parent | 6b40d77897b948fb2f02ba5e64b02ad4c0ba3bbf (diff) |
tweak the semantics so that no-default-conflict works.
requested by mbalmer@,sturm@. okay winiger@
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Search.pm | 40 |
2 files changed, 41 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index c60762f2fd0..7bb508daec2 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.24 2007/06/12 09:53:36 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.25 2007/12/28 12:55:03 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -37,8 +37,7 @@ sub make_conflict_list unless (defined $plist->{'no-default-conflict'}) { push(@$l, OpenBSD::Search::PkgSpec->new("$stem-*|partial-$stem-*")); } else { - $pkgname =~ s/p\d+$//; - push(@$l, OpenBSD::Search::PkgSpec->new("$pkgname|partial-$pkgname")); + push(@$l, OpenBSD::Search::Exact->new("$pkgname|partial-$pkgname")); } push(@$l, OpenBSD::Search::PkgSpec->new(".libs-$stem-*")); if (defined $plist->{conflict}) { diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index 21db9b2792e..63f86be40f6 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.7 2007/06/04 14:57:33 espie Exp $ +# $OpenBSD: Search.pm,v 1.8 2007/12/28 12:55:03 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -77,6 +77,44 @@ sub add_pkgpath_hint $self->{pkgpath} = $pkgpath; } +package OpenBSD::Search::Exact; +our @ISA=(qw(OpenBSD::Search::PkgSpec)); +sub match_ref +{ + my ($self, $r) = @_; + my @l = (); + + for my $subpattern (@{$self->{patterns}}) { + if ($subpattern !~ m/^(.*?)\-(\d[^-]*)(.*)$/o) { + next; + } + my ($stem, $version, $flavor) = ($1, $2, $3); + $version =~ s/p\d+//; + for my $pkg (@$r) { + if ($pkg eq $subpattern) { + push(@l, $pkg); + next; + } + if ($pkg !~ m/^(.*?)\-(\d[^-]*)(.*)$/o) { + next; + } + if ($1 ne $stem) { + next; + } + if ($3 ne $flavor) { + next; + } + my $pkgversion = $2; + $pkgversion =~ s/p\d+//; + if ($pkgversion ne $version) { + next; + } + push(@l, $pkg); + } + } + return @l; +} + package OpenBSD::Search::Stem; our @ISA=(qw(OpenBSD::Search)); |