diff options
author | 2009-11-30 18:45:14 +0000 | |
---|---|---|
committer | 2009-11-30 18:45:14 +0000 | |
commit | 24dd5be2701dd332c654b8a7dd8332c53cd5927d (patch) | |
tree | 137101b981524e6949d250e8a27e1a229c038a37 | |
parent | Crank __LDPGSZ from 4KB to 16KB, in preparation for a kernel page size (diff) | |
download | wireguard-openbsd-24dd5be2701dd332c654b8a7dd8332c53cd5927d.tar.xz wireguard-openbsd-24dd5be2701dd332c654b8a7dd8332c53cd5927d.zip |
tweak the rules a bit: the search filter for "more recent than" ought to
notice it sees older stuff. Even if they get filtered later on, this would
turn into a "no need to update".
(in actual use, I probably will need to open those packages and look at
the pkgpaths to make sure they are not valid candidates, and to compare
full signatures... oh well)
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Search.pm | 7 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 15 |
2 files changed, 18 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm index d850498b1c9..c6929a2778b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Search.pm +++ b/usr.sbin/pkg_add/OpenBSD/Search.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Search.pm,v 1.16 2009/11/10 14:37:20 espie Exp $ +# $OpenBSD: Search.pm,v 1.17 2009/11/30 18:45:14 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -153,7 +153,7 @@ sub filter_locations sub more_recent_than { - my ($class, $name) = @_; + my ($class, $name, $rfound) = @_; require OpenBSD::PackageName; my $f = OpenBSD::PackageName->from_string($name); @@ -166,6 +166,9 @@ sub { if ($f->{version}->compare($e->pkgname->{version}) <= 0) { push(@$r, $e); } + if (ref $rfound) { + $$rfound = 1; + } } return $r; }); diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 1b6440e8425..edb050e5cf7 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.106 2009/11/29 12:12:15 espie Exp $ +# $OpenBSD: Update.pm,v 1.107 2009/11/30 18:45:14 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -97,9 +97,10 @@ sub process_handle my @search = (); push(@search, OpenBSD::Search::Stem->split($pkgname)); my $found; + my $oldfound = 0; if (!$state->{defines}->{downgrade}) { - push(@search, OpenBSD::Search::FilterLocation->more_recent_than($pkgname)); + push(@search, OpenBSD::Search::FilterLocation->more_recent_than($pkgname, \$oldfound)); } push(@search, OpenBSD::Search::FilterLocation->new( sub { @@ -149,6 +150,16 @@ sub process_handle return 1; } } + if ($oldfound) { + $h->{update_found} = $h; + my $msg = "No need to update $pkgname"; + if (defined $state->{todo} && $state->{todo} > 0) { + $msg .= " ($state->{todo} to go)"; + } + $state->progress->message($msg); + $state->say($msg) if $state->{beverbose}; + return 0; + } return undef; } if (@$l == 1) { |