summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorJeremy Evans <jeremy@cvs.openbsd.org>2012-10-13 10:28:23 +0000
committerJeremy Evans <jeremy@cvs.openbsd.org>2012-10-13 10:28:23 +0000
commit7784d30e229c1ad7417ec3be12d51970d9c7b7c8 (patch)
tree875d2a4238f915da7f0af185d35e4f22c855c708 /usr.sbin/pkg_add/OpenBSD
parent0644745dbae35981a2b6bef82fdb777e425216aa (diff)
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@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-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) = @_;