diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-01-31 10:30:49 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-01-31 10:30:49 +0000 |
commit | 674955b0fd76d7dd84ce8f2f37ebe378786d48e3 (patch) | |
tree | 2237c152ed255af8b0434ab64954ce4b0c8693fe /usr.sbin/pkg_add/OpenBSD | |
parent | 68008a61fa7864ca3079d3be69c8fdc30b05aff7 (diff) |
handle conflict with partial in a less hackish ways, by passing an
extra "with_partial" parameter to specs.
This also removes quite a lot extraneous objects.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgSpec.pm | 18 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Search.pm | 7 |
3 files changed, 19 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index 57783b1d2bd..df115e52220 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.37 2011/07/02 12:12:58 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.38 2014/01/31 10:30:48 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -31,9 +31,9 @@ sub make_conflict_list my $stem = OpenBSD::PackageName::splitstem($pkgname); unless (defined $plist->{'no-default-conflict'}) { - push(@$l, OpenBSD::Search::PkgSpec->new("$stem-*|partial-$stem-*")); + push(@$l, OpenBSD::Search::PkgSpec->new("$stem-*", 1)); } else { - push(@$l, OpenBSD::Search::Exact->new("$pkgname|partial-$pkgname")); + push(@$l, OpenBSD::Search::Exact->new($pkgname, 1)); } if (defined $plist->{conflict}) { for my $cfl (@{$plist->{conflict}}) { diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 123cab41c44..d77bfde59df 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.40 2014/01/30 13:17:42 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.41 2014/01/31 10:30:48 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -295,7 +295,7 @@ sub add_flavor_constraints sub new { - my ($class, $p) = @_; + my ($class, $p, $with_partial) = @_; my $r = $class->parse($p); if (defined $r) { @@ -305,10 +305,16 @@ sub new $class->add_flavor_constraints($constraints, $r->{flavorspec}); my $o = bless { - exactstem => qr{^$stemspec$}, - fuzzystem => qr{^$stemspec\-\d.*$}, libstem => qr{^\.libs\d*\-$stemspec\-\d.*$}, }, $class; + + if ($with_partial) { + $o->{exactstem} = qr{^(partial\-)*$stemspec$}; + $o->{fuzzystem} = qr{^(partial\-)*$stemspec\-\d.*$}; + } else { + $o->{exactstem} = qr{^$stemspec$}; + $o->{fuzzystem} = qr{^$stemspec\-\d.*$}; + } if (@$constraints != 0) { $o->{constraints} = $constraints; } @@ -382,8 +388,8 @@ sub subpattern_class { "OpenBSD::PkgSpec::SubPattern" } sub new { - my ($class, $pattern) = @_; - my @l = map { $class->subpattern_class->new($_) } + my ($class, $pattern, $with_partial) = @_; + my @l = map { $class->subpattern_class->new($_, $with_partial) } (split /\|/o, $pattern); if (@l == 1) { return $l[0]; diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index ef29cc7fdbf..1acedc7b362 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.27 2011/07/02 12:12:58 espie Exp $ +# $OpenBSD: Search.pm,v 1.28 2014/01/31 10:30:48 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -57,10 +57,11 @@ sub filter_locations sub new { - my ($class, $pattern) = @_; + my ($class, $pattern, $with_partial) = @_; require OpenBSD::PkgSpec; - bless { spec => $class->spec_class->new($pattern)}, $class; + bless { spec => $class->spec_class->new($pattern, $with_partial)}, + $class; } sub add_pkgpath_hint |