summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-07 13:51:59 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-07 13:51:59 +0000
commitb7c1eafb0a947b4c2c72a99187851ec8c81d3915 (patch)
treee5564c07924baf24c9d9db1d1958ece6f51fd302 /usr.sbin/pkg_add
parent9313dc3e2216f22add9cac2242585afdea1f3d62 (diff)
make keep_most_recent explicit, do not try to pre-compute it at the stemlist
level.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm9
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm5
-rw-r--r--usr.sbin/pkg_add/pkg_add4
3 files changed, 8 insertions, 10 deletions
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 <espie@openbsd.org>
#
@@ -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 <espie@openbsd.org>
#
@@ -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 <espie@openbsd.org>
#
@@ -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);