diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-12 15:19:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-12 15:19:01 +0000 |
commit | 2a4119d949ae6b146b508de15393b07048f128d0 (patch) | |
tree | b74bbd479b628b8dc298ce9bfc727c70adbbdc3d | |
parent | 2491cf3ea853b2d89c8d2d9dcae5fdfb6c6e6f2b (diff) |
lift PkgSpec creation up into PackingElement::Dependency.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index a96ea62197b..02433f8d5f2 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.20 2007/05/12 14:38:30 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.21 2007/05/12 15:19:00 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -21,7 +21,6 @@ use warnings; package OpenBSD::Dependencies; use OpenBSD::PackageName; -use OpenBSD::PkgSpec; use OpenBSD::PackageInfo; use OpenBSD::SharedLibs; use OpenBSD::Error; @@ -59,7 +58,7 @@ sub solve my @deps; for my $dep (@{$plist->{depend}}) { - my $spec = OpenBSD::PkgSpec->new($dep->{pattern}); + my $spec = $dep->spec; if ($state->{replace}) { my $v = find_candidate($spec, keys %{$to_install}); if ($v) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 4cc8f2a1439..ff504eac1ac 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.104 2007/05/12 14:48:45 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.105 2007/05/12 15:19:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -671,6 +671,16 @@ sub stringize($) return $self->{pkgpath}.':'.$self->{pattern}.':'.$self->{def}; } +sub spec +{ + my $self = shift; + if (!defined $self->{spec}) { + require OpenBSD::PkgSpec; + $self->{spec} = OpenBSD::PkgSpec->new($self->{pattern}); + } + return $self->{spec}; +} + package OpenBSD::PackingElement::Wantlib; our @ISA=qw(OpenBSD::PackingElement::Depend); |