summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-29 12:12:16 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-29 12:12:16 +0000
commite92b7f54d179dd6e3eec2ca7ec4d2dd3c83d3392 (patch)
tree9753bd7e5c812586ccc7e0e4557f20ccbea624ee /usr.sbin
parenta08473e8e40f55174a311d782aa6bea96f670285 (diff)
in the worst case, we find a new handle with the right pkgpath,
independently of the name...
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm24
1 files changed, 18 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 604bf38c290..1b6440e8425 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.105 2009/11/24 11:41:56 espie Exp $
+# $OpenBSD: Update.pm,v 1.106 2009/11/29 12:12:15 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -86,10 +86,17 @@ sub process_handle
$state->say("Not updating $pkgname, remember to clean it");
return 0;
}
+
+ my $plist = OpenBSD::PackingList->from_installation($pkgname,
+ \&OpenBSD::PackingList::UpdateInfoOnly);
+ if (!defined $plist) {
+ Fatal("Can't locate $pkgname");
+ }
+
+
my @search = ();
push(@search, OpenBSD::Search::Stem->split($pkgname));
my $found;
- my $plist;
if (!$state->{defines}->{downgrade}) {
push(@search, OpenBSD::Search::FilterLocation->more_recent_than($pkgname));
@@ -101,10 +108,6 @@ sub process_handle
return $l;
}
my @l2 = ();
- $plist = OpenBSD::PackingList->from_installation($pkgname, \&OpenBSD::PackingList::UpdateInfoOnly);
- if (!defined $plist) {
- Fatal("Can't locate $pkgname");
- }
for my $handle (@$l) {
$handle->set_arch($state->{arch});
if (!$handle) {
@@ -137,6 +140,15 @@ sub process_handle
my $l = OpenBSD::PackageLocator->match_locations(@search);
if (@$l == 0) {
+ # XXX this is nasty: maybe we added an old set to update
+ # because of conflicts, in which case the pkgpath +
+ # conflict should be enough to "match".
+ for my $n ($set->newer) {
+ if ($n->location->update_info->match_pkgpath($plist)) {
+ $self->add_handle($set, $h, $n);
+ return 1;
+ }
+ }
return undef;
}
if (@$l == 1) {