From b7c1eafb0a947b4c2c72a99187851ec8c81d3915 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 7 May 2007 13:51:59 +0000 Subject: make keep_most_recent explicit, do not try to pre-compute it at the stemlist level. --- usr.sbin/pkg_add/OpenBSD/PackageName.pm | 9 ++------- usr.sbin/pkg_add/OpenBSD/Update.pm | 5 ++++- usr.sbin/pkg_add/pkg_add | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 98c625c6a24..471f77bc2ae 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.15 2007/04/15 10:17:29 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.16 2007/05/07 13:51:58 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -149,23 +149,18 @@ sub compile_stemlist sub avail2stems { - my $state = shift; my @avail = @_; if (@avail == 0) { require OpenBSD::Error; OpenBSD::Error::Warn("No packages available in the PKG_PATH\n"); } - unless ($state->{forced}->{allversions}) { - @avail = OpenBSD::PackageName::keep_most_recent(@avail); - } return OpenBSD::PackageName::compile_stemlist(@avail); } sub available_stems { - my $state = shift; - return avail2stems($state, OpenBSD::PackageLocator::available()); + return avail2stems(OpenBSD::PackageLocator::available()); } package OpenBSD::PackageLocator::_compiled_stemlist; diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 3125bef1076..36ee3967425 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.67 2007/05/02 15:05:30 espie Exp $ +# $OpenBSD: Update.pm,v 1.68 2007/05/07 13:51:58 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie # @@ -54,6 +54,9 @@ sub find next; } my @l2 = (); + if (@l > 1 && !$state->{forced}->{allversions}) { + @l = OpenBSD::PackageName::keep_most_recent(@l); + } if (@l == 1 && $state->{forced}->{pkgpath}) { OpenBSD::ProgressMeter::clear(); print "Directly updating $pkgname -> ", $l[0], "\n"; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 2413116c778..71add1224bf 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.234 2007/05/07 12:19:04 espie Exp $ +# $OpenBSD: pkg_add,v 1.235 2007/05/07 13:51:58 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -598,7 +598,7 @@ sub find_truenames $path = ""; } my @l = $h->findstem($pkgname); - if (@l > 1) { + if (@l > 1 && !$state->{forced}->{allversions}) { @l = OpenBSD::PackageName::keep_most_recent(@l); } my $result = OpenBSD::Interactive::choose1($pkgname, $state->{interactive}, sort @l); -- cgit v1.2.3