summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2018-07-18 13:06:24 +0000
committerMarc Espie <espie@cvs.openbsd.org>2018-07-18 13:06:24 +0000
commit090bc8e30aceb6283e869b1e2b88fdff699b3356 (patch)
tree903f18d46951f640873615b4ebda64a201c153ea /usr.sbin
parentaa74b5d8ec77199ae38087d51bb58d0a39129d92 (diff)
make the logic for deleting first slightly more obvious
in particular, there's nothing to try if we don't have older packages
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm22
1 files 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 <espie@openbsd.org>
#
@@ -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}) {