Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
pkg_add: stop advising to remove files on update
To:
ports <ports@openbsd.org>
Date:
Sun, 27 Apr 2025 11:24:32 +0000

Download raw body.

Thread
Make that last line disappear unless you actually delete the package:

	# pkg_add -uDinstalled ietf-cli
	quirks-7.105:updatedb-0p0->0p0: ok
	quirks-7.105 signed on 2025-04-26T20:42:44Z
	quirks-7.105->7.105: ok
	[...]
	ietf-cli-1.29p0->1.29p0: ok
	Read shared items: ok
	--- -ietf-cli-1.29p0 -------------------
	You should also run rm -rf /var/db/ietf-mirrors/*

So `pkg_delete ietf-cli' will still print it.

There are various forms of "You should also ..." messages, I only changed
those inside delete() functions, but perhaps there's more.

Feedback? OK?

Index: /s/usr.sbin/pkg_add/OpenBSD/Delete.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/Delete.pm,v
diff -u -p -r1.169 Delete.pm
--- /s/usr.sbin/pkg_add/OpenBSD/Delete.pm	11 Oct 2023 13:54:43 -0000	1.169
+++ /s/usr.sbin/pkg_add/OpenBSD/Delete.pm	27 Apr 2025 11:19:09 -0000
@@ -606,7 +606,7 @@ sub delete($self, $state)
 	if ($state->{extra}) {
 		unlink($realname) or
 		    $state->say("problem deleting extra file #1: #2", $realname, $!);
-	} else {
+	} elsif (!$state->{update}) {
 		$state->log("You should also remove #1", $realname);
 		$self->mark_dir($state);
 	}
@@ -621,7 +621,7 @@ sub delete($self, $state)
 	my $realname = $self->realname($state);
 	if ($state->{extra}) {
 		$self->SUPER::delete($state);
-	} else {
+	} elsif (!$state->{update}) {
 		$state->log("You should also remove the directory #1", $realname);
 		$self->mark_dir($state);
 	}
@@ -633,7 +633,7 @@ sub delete($self, $state)
 {
 	if ($state->{extra}) {
 		$self->run($state);
-	} else {
+	} elsif (!$state->{update}) {
 		$state->log("You should also run #1", $self->{expanded});
 	}
 }