diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-01-05 12:01:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-01-05 12:01:08 +0000 |
commit | e20f1949b10b578e6ecefcd73c91e3c57b6d7c59 (patch) | |
tree | 44e70d4de9efa3cee23decf4b0c8280f989e0199 /usr.sbin/pkg_add | |
parent | 46acfb8e2b7ffb4449b57946073593b07bcc8f61 (diff) |
tracker and updater are also auto-cached
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index cf3094cca56..215585b16c6 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.462 2010/01/05 11:42:45 espie Exp $ +# $OpenBSD: pkg_add,v 1.463 2010/01/05 12:01:07 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -104,25 +104,17 @@ sub set_name_from_handle $state->log->set_context($extra.$h->pkgname); } -sub updater -{ - my $state = shift; - if (!defined $state->{updater}) { - require OpenBSD::Update; - $state->{updater} = OpenBSD::Update->new; - } - return $state->{updater}; -} +OpenBSD::Auto::cache(updater, + sub { + require OpenBSD::Update; + return OpenBSD::Update->new; + }); -sub tracker -{ - my $state = shift; - if (!defined $state->{tracker}) { - require OpenBSD::Tracker; - $state->{tracker} = OpenBSD::Tracker->new; - } - return $state->{tracker}; -} +OpenBSD::Auto::cache(tracker, + sub { + require OpenBSD::Tracker; + return OpenBSD::Tracker->new; + }); sub quirks { @@ -168,12 +160,12 @@ use OpenBSD::Error; OpenBSD::Auto::cache(solver, sub { - return OpenBSD::Dependencies::Solver->new(shift); + return OpenBSD::Dependencies::Solver->new(shift); }); OpenBSD::Auto::cache(conflict_cache, sub { - return OpenBSD::ConflictCache->new; + return OpenBSD::ConflictCache->new; }); sub setup_header |