Index | Thread | Search

From:
Kurt Mosiejczuk <kurt@cranky.work>
Subject:
Re: pkg_add: stop advising to remove files on update
To:
Klemens Nanni <kn@openbsd.org>
Cc:
ports <ports@openbsd.org>
Date:
Mon, 28 Apr 2025 06:13:17 -0400

Download raw body.

Thread
On Sun, Apr 27, 2025 at 11:24:32AM +0000, Klemens Nanni wrote:
> 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?

Yes please. It's been too long that this situation has been confusing
users.

My testing makes me happy with this.

ok kmos

--Kurt

> 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});
>  	}
>  }
>