summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-10-10 11:06:05 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-10-10 11:06:05 +0000
commitbcd6a84428a089f780a9471e1cec3eecde476179 (patch)
tree49721517c9cf69d1beb73f9db6a0525c33432f9e /usr.sbin/pkg_add
parent3a052124de760ffc32db4dbfa32c06adc7977719 (diff)
several paths lead to has_new_sig, cache the result.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_add15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index ae85b9a8911..b2b186e24b0 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.205 2005/10/10 11:02:19 espie Exp $
+# $OpenBSD: pkg_add,v 1.206 2005/10/10 11:06:04 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -43,11 +43,14 @@ our $not;
sub has_new_sig
{
my ($plist, $state) = @_;
- my $n = OpenBSD::PackingList->from_installation($plist->pkgname())->signature();
- my $o = $plist->signature();
- print "Comparing full signature for ", $plist->pkgname(), " \"$o\" vs. \"$n\": ", $n eq $o ? "equal\n" : "different\n"
- if $state->{very_verbose};
- return $n ne $o;
+ if (!defined $plist->{new_sig}) {
+ my $n = OpenBSD::PackingList->from_installation($plist->pkgname())->signature();
+ my $o = $plist->signature();
+ print "Comparing full signature for ", $plist->pkgname(), " \"$o\" vs. \"$n\": ", $n eq $o ? "equal\n" : "different\n"
+ if $state->{very_verbose};
+ $plist->{new_sig} = $n ne $o;
+ }
+ return $plist->{new_sig};
}