From: espie Date: Wed, 25 Dec 2013 15:59:51 +0000 (+0000) Subject: fix autoloading of quirks: don't try to run quirks while processing the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6fe055f519e5c3a3cb250908643bcbe56f9b4e83;p=openbsd fix autoloading of quirks: don't try to run quirks while processing the quirks set, as we may accidentally load the old one. also, in case we can't load quirks, report if quirks should be there, e.g., compilation error, without regard to verbose status --- diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 91dc7b6b752..8022e55471c 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.57 2013/12/25 14:20:48 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.58 2013/12/25 15:59:51 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie # @@ -278,8 +278,12 @@ sub run_quirks $state->{quirks} = OpenBSD::Quirks->new(1); }; if ($@) { - $state->errsay("Can't load quirk: #1", $@) - if $state->verbose >= 2; + my $show = $state->verbose >= 2; + if (!$show) { + my $l = $state->repo->installed->match_locations(OpenBSD::Search::Stem->new('quirks')); + $show = @$l > 0; + } + $state->errsay("Can't load quirk: #1", $@) if $show; # cache that this didn't work $state->{quirks} = undef; } diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 3e69d1fb071..66921ef6191 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.154 2013/12/25 14:20:48 espie Exp $ +# $OpenBSD: Update.pm,v 1.155 2013/12/25 15:59:51 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie # @@ -88,16 +88,18 @@ sub process_handle return 0; } - my $base = 0; - $state->run_quirks( - sub { - my $quirks = shift; - $base = $quirks->is_base_system($h, $state); - }); - if ($base) { - $h->{update_found} = OpenBSD::Handle->system; - $set->{updates}++; - return 1; + if (!$set->{quirks}) { + my $base = 0; + $state->run_quirks( + sub { + my $quirks = shift; + $base = $quirks->is_base_system($h, $state); + }); + if ($base) { + $h->{update_found} = OpenBSD::Handle->system; + $set->{updates}++; + return 1; + } } my $plist = OpenBSD::PackingList->from_installation($pkgname, @@ -124,11 +126,13 @@ sub process_handle } push(@search, OpenBSD::Search::Stem->split($sname)); - $state->run_quirks( - sub { - my $quirks = shift; - $quirks->tweak_search(\@search, $h, $state); - }); + if (!$set->{quirks}) { + $state->run_quirks( + sub { + my $quirks = shift; + $quirks->tweak_search(\@search, $h, $state); + }); + } my $oldfound = 0; my @skipped_locs = ();