diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-06-19 08:22:07 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-06-19 08:22:07 +0000 |
commit | 6ecd08a83368dc12fc1dbff5bd021a0617cae92b (patch) | |
tree | da03348b0b56039a13e74c7799feb9f752c3e547 | |
parent | 65686a07418ebbd8dd0f6ed3f6d8cc9ab5c96ecc (diff) |
let build libspec match as they should.
namely, if a shared lib exists, then a static library should not match
if the version number is not okay.
problem noticed by sthen@, okay sthen@
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/LibSpec.pm | 15 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm | 25 |
2 files changed, 25 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm index abbcb413da0..eb9d62b25e8 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: LibSpec.pm,v 1.9 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: LibSpec.pm,v 1.10 2010/06/19 08:22:06 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -81,19 +81,6 @@ sub lookup return $r; } -sub findbest -{ - my ($spec, $repo, $base) = @_; - my $r = $spec->lookup($repo, $base); - my $best; - for my $candidate (@$r) { - if (!defined $best || $candidate->is_better($best)) { - $best = $candidate; - } - } - return $best; -} - package OpenBSD::BadLib; our @ISA=qw(OpenBSD::LibObject); diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm index 4c0358bf626..d4a04509cac 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec/Build.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Build.pm,v 1.2 2010/05/10 09:17:55 espie Exp $ +# $OpenBSD: Build.pm,v 1.3 2010/06/19 08:22:06 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -68,6 +68,29 @@ sub no_match_static &OpenBSD::LibSpec::no_match_name; } +sub findbest +{ + my ($spec, $repo, $base) = @_; + my $spec2 = OpenBSD::LibSpec::GT->new($spec->{dir}, $spec->{stem}, + 0, 0); + my $r = $spec2->lookup($repo, $base); + my $best; + for my $candidate (@$r) { + if (!defined $best || $candidate->is_better($best)) { + $best = $candidate; + } + } + if (defined $best) { + if ($best->is_static) { + return $best; + } + if ($spec->match($best, $base)) { + return $best; + } + } + return undef; +} + package OpenBSD::LibSpec::GT; our @ISA = qw(OpenBSD::LibSpec); sub no_match_major |