From 3c675cda73364f4ecf73f8aed6d350461ece0e1a Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 18 Jul 2018 13:06:23 +0000 Subject: [PATCH] make the logic for deleting first slightly more obvious in particular, there's nothing to try if we don't have older packages --- usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index c52d8ab8174..68b125f344d 100644 --- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm +++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: UpdateSet.pm,v 1.80 2018/06/26 09:40:33 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.81 2018/07/18 13:06:23 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie # @@ -430,15 +430,17 @@ sub validate_plists } if (defined $state->{overflow}) { $state->vstat->tally; - # okay, let's retry the other way around if we haven't yet - if (!defined $state->{delete_first}) { - if ($state->defines('deletefirst') || - $state->confirm_defaults_to_no( - "Delete older packages first")) { - $state->{delete_first} = 1; - $state->vstat->drop_changes; - return $self->validate_plists($state); - } + $state->vstat->drop_changes; + # nothing to try if we don't have existing stuff to remove + return 0 if $self->older == 0; + # we already tried the other way around... + return 0 if $state->{delete_first}; + if ($state->defines('deletefirst') || + $state->confirm_defaults_to_no( + "Delete older packages first")) { + # okay we recurse doing things the other way around + $state->{delete_first} = 1; + return $self->validate_plists($state); } } if ($state->{problems}) { -- 2.20.1