summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremy <jeremy@openbsd.org>2012-10-13 10:28:22 +0000
committerjeremy <jeremy@openbsd.org>2012-10-13 10:28:22 +0000
commit2f37e678a15d990083812281fbcea114dc0737f3 (patch)
treea62abea4c37086ac526511f0cdab5b705ecb45c6
parentwe are now warning about this ! (diff)
downloadwireguard-openbsd-2f37e678a15d990083812281fbcea114dc0737f3.tar.xz
wireguard-openbsd-2f37e678a15d990083812281fbcea114dc0737f3.zip
In update verbose mode, when skipping an update candidate due to an
unmatching pkgpath, if no valid update candidates are found, print that we are skipping the update candidate and all pkgpaths for both the currently installed package and the skipped update candidate. This is designed to help diagnosing issues when ports move locations in the tree, but the necessary @pkgpath entries are not correctly added to the PLIST. Much help and OK espie@
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm13
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm32
2 files changed, 42 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index ccbbeb57d93..24edaa23654 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.207 2012/07/12 08:57:02 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.208 2012/10/13 10:28:22 jeremy Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -1863,6 +1863,17 @@ sub new
}, $class;
}
+sub fullpkgpath
+{
+ my ($self) = @_;
+ if(%{$self->{mandatory}}) {
+ my $m = join(",", keys %{$self->{mandatory}});
+ return "$self->{dir},$m";
+ } else {
+ return $self->{dir};
+ }
+}
+
# a pkgpath has a dir, and some flavors/multi parts. To match, we must
# remove them all. So, keep a full hash of everything we have (has), and
# when stuff $to_rm matches, remove them from $from.
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 0cce8ba1767..4300aa5f71d 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.152 2012/04/28 11:55:16 espie Exp $
+# $OpenBSD: Update.pm,v 1.153 2012/10/13 10:28:22 jeremy Exp $
#
# Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org>
#
@@ -126,6 +126,7 @@ sub process_handle
$state->quirks->tweak_search(\@search, $h, $state);
};
my $oldfound = 0;
+ my @skipped_locs = ();
# XXX this is nasty: maybe we added an old set to update
# because of conflicts, in which case the pkgpath +
@@ -164,7 +165,7 @@ sub process_handle
}
}
if (!$plist->match_pkgpath($p2)) {
- $loc->forget;
+ push(@skipped_locs, $loc);
next
}
if ($p2->has('explicit-update') && $state->{allupdates}) {
@@ -188,6 +189,15 @@ sub process_handle
}
my $l = $set->match_locations(@search);
+
+ for my $loc (@skipped_locs) {
+ if (@$l == 0 && $state->verbose) {
+ $self->say_skipped_packages($state, $plist,
+ $loc->update_info);
+ }
+ $loc->forget;
+ }
+
if (@$l == 0) {
if ($oldfound) {
$h->{update_found} = $h;
@@ -213,6 +223,24 @@ sub process_handle
}
}
+sub say_skipped_packages
+{
+ my ($self, $state, $o, $n) = @_;
+
+ my $o_name = $o->pkgname;
+ my @o_ps = map { @{$o->pkgpath->{$_}} } keys %{$o->pkgpath};
+ my $o_pp = join(" ", map {$_->fullpkgpath} @o_ps);
+
+ my $n_name = $n->pkgname;
+ my @n_ps = map { @{$n->pkgpath->{$_}} } keys %{$n->pkgpath};
+ my $n_pp= join(" ", map {$_->fullpkgpath} @n_ps);
+
+ my $t = "Skipping #1 (update candidate for #2)";
+ $t .= "\n\t#2 pkgpaths: #4\n\t#1 pkgpaths: #3";
+
+ $state->say($t, $n_name, $o_name, $n_pp, $o_pp);
+}
+
sub find_nearest
{
my ($base, $locs) = @_;