diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-01-05 11:31:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-01-05 11:31:08 +0000 |
commit | 9b59cee6bbbdf8e9305528337dcbdff79cbf3271 (patch) | |
tree | 880594c7bb2424452ec7b199ff7dc6abe4b331e0 /usr.sbin | |
parent | 28fdca0736b5b65cad750b8c7908a3e45f9cdbd4 (diff) |
use Auto::cache
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm | 2 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm | 2 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm | 2 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 18 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Search.pm | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 26 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create.1 | 5 |
7 files changed, 25 insertions, 33 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm index 72bb318e737..414d47ab6be 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Installed.pm,v 1.15 2009/11/10 14:37:20 espie Exp $ +# $OpenBSD: Installed.pm,v 1.16 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index 35ace4f4ef9..ab581f206a6 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SCP.pm,v 1.19 2009/06/06 10:13:29 espie Exp $ +# $OpenBSD: SCP.pm,v 1.20 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm index 68a56cbedb0..d54d804cd39 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Source.pm,v 1.8 2008/07/04 10:47:13 espie Exp $ +# $OpenBSD: Source.pm,v 1.9 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 40346793d21..0bed2ebd387 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.168 2010/01/01 13:36:07 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.169 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -921,16 +921,14 @@ sub stringize (qw(pkgpath pattern def))); } -sub spec -{ +OpenBSD::Auto::cache(spec, + sub { + require OpenBSD::Search; + my $self = shift; - if (!defined $self->{spec}) { - require OpenBSD::Search; - $self->{spec} = OpenBSD::Search::PkgSpec->new($self->{pattern}); - $self->{spec}->add_pkgpath_hint($self->{pkgpath}); - } - return $self->{spec}; -} + return OpenBSD::Search::PkgSpec->new($self->{pattern}) + ->add_pkgpath_hint($self->{pkgpath}); + }); package OpenBSD::PackingElement::Wantlib; our @ISA=qw(OpenBSD::PackingElement::Depend); diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index ea1ff2f208e..7568564ea37 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.19 2009/12/27 00:22:44 espie Exp $ +# $OpenBSD: Search.pm,v 1.20 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -61,6 +61,7 @@ sub add_pkgpath_hint { my ($self, $pkgpath) = @_; $self->{pkgpath} = $pkgpath; + return $self; } sub spec_class diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 8f715e3beb7..e3e50492965 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.460 2010/01/04 00:10:52 espie Exp $ +# $OpenBSD: pkg_add,v 1.461 2010/01/05 11:31:07 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -166,23 +166,15 @@ package OpenBSD::UpdateSet; use OpenBSD::PackageInfo; use OpenBSD::Error; -sub solver -{ - my $set = shift; - if (!defined $set->{solver}) { - $set->{solver} = OpenBSD::Dependencies::Solver->new($set); - } - return $set->{solver}; -} +OpenBSD::Auto::cache(solver, + sub { + return OpenBSD::Dependencies::Solver->new(shift); + }); -sub conflict_cache -{ - my $set = shift; - if (!defined $set->{conflict_cache}) { - $set->{conflict_cache} = OpenBSD::ConflictCache->new; - } - return $set->{conflict_cache}; -} +OpenBSD::Auto::cache(conflict_cache, + sub { + return OpenBSD::ConflictCache->new; + }); sub setup_header { diff --git a/usr.sbin/pkg_add/pkg_create.1 b/usr.sbin/pkg_add/pkg_create.1 index 0f210921729..a1bd423af8f 100644 --- a/usr.sbin/pkg_add/pkg_create.1 +++ b/usr.sbin/pkg_add/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_create.1,v 1.53 2010/01/03 16:43:46 schwarze Exp $ +.\" $OpenBSD: pkg_create.1,v 1.54 2010/01/05 11:31:07 espie Exp $ .\" .\" Documentation and design originally from FreeBSD. All the code has .\" been rewritten since. We keep the documentation's notice: @@ -21,7 +21,7 @@ .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" -.Dd $Mdocdate: January 3 2010 $ +.Dd $Mdocdate: January 5 2010 $ .Dt PKG_CREATE 1 .Os .Sh NAME @@ -245,6 +245,7 @@ All these commands start with an Here is a list: .Pp .Bl -tag -width Ds -compact +.Pp .It Cm @arch Ar arches List of architectures for which this package is intended. .Pp |