From 083889ef6be124807fa8c157461064dc15f40a17 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 30 Jan 2014 13:17:43 +0000 Subject: most PkgSpec are default conflicts, so not storing empty constraints... --- usr.sbin/pkg_add/OpenBSD/PkgSpec.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 2ebb4c29197..123cab41c44 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.39 2011/08/31 22:50:21 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.40 2014/01/30 13:17:42 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -308,8 +308,10 @@ sub new exactstem => qr{^$stemspec$}, fuzzystem => qr{^$stemspec\-\d.*$}, libstem => qr{^\.libs\d*\-$stemspec\-\d.*$}, - constraints => $constraints, }, $class; + if (@$constraints != 0) { + $o->{constraints} = $constraints; + } if (defined $r->{e}) { $o->{e} = 1; } @@ -328,8 +330,10 @@ LOOP1: for my $s (grep(/$o->{fuzzystem}/, @$list)) { my $name = OpenBSD::PackageName->from_string($s); next unless $name->{stem} =~ m/^$o->{exactstem}$/; - for my $c (@{$o->{constraints}}) { - next LOOP1 unless $c->match($name); + if (defined $o->{constraints}) { + for my $c (@{$o->{constraints}}) { + next LOOP1 unless $c->match($name); + } } if (wantarray) { push(@result, $s); @@ -357,8 +361,10 @@ LOOP2: for my $s (grep { $_->name =~ m/$o->{fuzzystem}/} @$list) { my $name = $s->pkgname; next unless $name->{stem} =~ m/^$o->{exactstem}$/; - for my $c (@{$o->{constraints}}) { - next LOOP2 unless $c->match($name); + if (defined $o->{constraints}) { + for my $c (@{$o->{constraints}}) { + next LOOP2 unless $c->match($name); + } } push(@$result, $s); } -- cgit v1.2.3