diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-11-16 14:47:06 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-11-16 14:47:06 +0000 |
commit | 2cc1ee1bc9a928fdb96b50ea985a4b5e63df5e66 (patch) | |
tree | 0ded9ae7193f1562c1e4e37aff9ed2f5ea73cb39 /usr.sbin | |
parent | e1af5a0f736b329a05da47f95370d0f2d7421f03 (diff) |
unify hint and location processing some more.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 9 |
2 files changed, 13 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 757a76a424d..0ee017497a0 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.93 2009/11/11 12:04:19 espie Exp $ +# $OpenBSD: Update.pm,v 1.94 2009/11/16 14:47:05 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -36,6 +36,7 @@ sub add_updateset my ($self, $set, $handle, $location) = @_; my $n = OpenBSD::Handle->from_location($location); + $handle->{done} = $n; $set->add_newer($n); } @@ -141,19 +142,20 @@ sub process_hint my ($self, $set, $hint, $state) = @_; my $l; + my $hint_name = $hint->pkgname; my $k = OpenBSD::Search::FilterLocation->keep_most_recent; # first try to find us exactly $state->progress->message("Looking for $hint"); - $l = OpenBSD::PackageLocator->match_locations(OpenBSD::Search::Exact->new($hint), $k); + $l = OpenBSD::PackageLocator->match_locations(OpenBSD::Search::Exact->new($hint_name), $k); if (@$l == 0) { - my $t = $hint; + my $t = $hint_name; $t =~ s/\-\d([^-]*)\-?/--/; $l = OpenBSD::PackageLocator->match_locations(OpenBSD::Search::Stem->new($t), $k); } - my $r = $state->choose_location($hint, $l); + my $r = $state->choose_location($hint_name, $l); if (defined $r) { - $self->add_updateset($set, undef, $r); + $self->add_updateset($set, $hint, $r); return 1; } else { return 0; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index fcd933ad4b7..0b431faedc6 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.385 2009/11/16 12:53:27 espie Exp $ +# $OpenBSD: pkg_add,v 1.386 2009/11/16 14:47:05 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org> # @@ -665,8 +665,11 @@ sub process_parameters $state->progress->set_header("Looking for packages"); for my $_ (@ARGV) { my $set = OpenBSD::UpdateSet->new->add_hints($_); - if ($state->updater->process_hint($set, $_, $state)) { - push(@todo2, $set); + for my $hint ($set->hints) { + if ($state->updater->process_hint($set, + $hint, $state)) { + push(@todo2, $set); + } } } # 2/ update existing stuff |