From bcd6a84428a089f780a9471e1cec3eecde476179 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 10 Oct 2005 11:06:05 +0000 Subject: several paths lead to has_new_sig, cache the result. --- usr.sbin/pkg_add/pkg_add | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'usr.sbin/pkg_add') 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 # @@ -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}; } -- cgit v1.2.3