From: espie Date: Wed, 6 Oct 2021 14:23:50 +0000 (+0000) Subject: fix for the XXX-warning warning... have the test be a bit more specific X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f62509bdc18c8df747ae47c952cdae339ceaee51;p=openbsd fix for the XXX-warning warning... have the test be a bit more specific for the really bizarre case where we would end up having several update paths. --- diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index 18dccc8cf09..a676e171f8c 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.120 2021/06/28 14:17:01 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.121 2021/10/06 14:23:50 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -463,6 +463,23 @@ LOOP: for my $c (@conflicts) { return 1; } +sub find_belated_update +{ + my ($set, $state, $old) = @_; + + for my $n ($set->newer) { + if ($n->conflict_list->conflicts_with($old->pkgname)) { + if (defined $old->{update_found}) { + $state->errsay("Ambiguous update #1 vs #2", + $n->pkgname, + $old->{update_found}->pkgname); + } else { + $old->{update_found} = $n; + } + } + } +} + sub install_issues { my ($set, $state) = @_; @@ -503,8 +520,9 @@ sub install_issues if (defined $s && $s ne $set) { $set->merge($state->tracker, $s); } else { - $set->add_older(OpenBSD::Handle->create_old($toreplace, - $state)); + my $h = OpenBSD::Handle->create_old($toreplace, $state); + $set->add_older($h); + find_belated_update($set, $state, $h); } }