summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-30 18:45:15 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-30 18:45:15 +0000
commite1b0da13fb6d4f7ea77f62b3e535380041b052af (patch)
tree1385872f8f0afd73f7a4ae2098f0adfb678185c7 /usr.sbin/pkg_add/OpenBSD
parentbe5ae23d8ba7b70153d7b2647d0f18fe2ecc0840 (diff)
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)
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Search.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm15
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) {