More specifically: add an indirection to solving dependencies for pure pkg_delete, so that we don't end up constructing full UpdateSets for no reason
Index: AddCreateDelete.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm,v retrieving revision 1.43 diff -u -p -r1.43 AddCreateDelete.pm --- AddCreateDelete.pm 27 Feb 2018 22:46:53 -0000 1.43 +++ AddCreateDelete.pm 10 Sep 2019 09:45:36 -0000 @@ -171,6 +171,13 @@ sub ntogo_string $self->f(""); } +sub solve_dependency +{ + my ($self, $solver, $dep, $package) = @_; + # full dependency solving with everything + return $solver->really_solve_dependency($self, $dep, $package); +} + package OpenBSD::AddCreateDelete; use OpenBSD::Error; Index: PkgDelete.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm,v retrieving revision 1.45 diff -u -p -r1.45 PkgDelete.pm --- PkgDelete.pm 10 Jul 2018 10:37:59 -0000 1.45 +++ PkgDelete.pm 10 Sep 2019 09:45:36 -0000 @@ -131,6 +131,13 @@ sub deleteset_from_location return $self->deleteset->add_older(OpenBSD::Handle->from_location($location)); } +sub solve_dependency +{ + my ($self, $solver, $dep, $package) = @_; + # simpler dependency solving + return $solver->find_dep_in_installed($self, $dep); +} + package OpenBSD::DeleteSet; sub setup_header { Index: Dependencies/SolverBase.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm,v retrieving revision 1.10 diff -u -p -r1.10 SolverBase.pm --- Dependencies/SolverBase.pm 7 Jul 2018 06:25:53 -0000 1.10 +++ Dependencies/SolverBase.pm 10 Sep 2019 09:45:36 -0000 @@ -326,7 +326,8 @@ sub solve_dependency $state->say("No cache hit on #1", $dep->{pattern}); } - $self->really_solve_dependency($state, $dep, $package); + # we need an indirection because deleting is simpler + $state->solve_dependency($self, $dep, $package); } sub solve_depends