diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2013-12-25 15:59:52 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2013-12-25 15:59:52 +0000 |
commit | a56ca9242c27a7d1082e220dabf563c0221630fc (patch) | |
tree | d3f8ee0ad638dcb9769a3e9bfc5d65c4b72f689f | |
parent | 5b38e470abaa27518dd85d8b91e543bd2170b9ee (diff) |
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
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 36 |
2 files changed, 27 insertions, 19 deletions
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 <espie@openbsd.org> # @@ -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 <espie@openbsd.org> # @@ -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 = (); |