summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2013-12-25 15:59:51 +0000
committerespie <espie@openbsd.org>2013-12-25 15:59:51 +0000
commit6fe055f519e5c3a3cb250908643bcbe56f9b4e83 (patch)
tree394f7169a4d0e7b84aac9071be3d5319e8ddcc95
parentPass _dl_dtors as the csu cleanup routine on sh (diff)
downloadwireguard-openbsd-6fe055f519e5c3a3cb250908643bcbe56f9b4e83.tar.xz
wireguard-openbsd-6fe055f519e5c3a3cb250908643bcbe56f9b4e83.zip
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.pm10
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm36
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 = ();