Deletion of just installed port-packages (excluding base): success

From: Graham Perrin <grahamperrin_at_gmail.com>
Date: Thu, 07 Aug 2025 09:01:07 UTC
On 07/08/2025 06:44, Jesús Daniel Colmenares Oviedo wrote:

> Perhaps something like this (with a few additions):
>
>
> ```
> pkg query %n | grep -vEe '^(FreeBSD-.+)' | xargs pkg remove -n && pkg 
> autoremove -n && pkg clean -n
>
> ```
>

This is good. Thank you, Mark and Jesús, for progressing this.


xargs pkg delete -fqy.txt (attached)
====================================

Quiet, forced deletion -- without question -- of pkg, pkg-provides, and 
around 830 other non-base packages.

The subsequent bootstrap of pkg succeeded.

My first use of the bootstrapped pkg failed only because re: 
<https://www.freshports.org/ports-mgmt/pkg-provides/#message>, I had 
omitted to reconfigure /usr/local/etc/pkg.conf for pkg to work without 
the plugin.


xargs dry run.txt (attached)
====================================

All normal, as far as I can tell, with the dry run.

833 non-base packages. No base package will be deleted.


xargs pkg delete -y.txt (attached)
====================================

Assuming yes, without also applying force, naturally stops when pkg will 
not delete itself.


Making a command memorable
====================================

An alias is tempting, however from 
<https://github.com/freebsd/pkg/pull/2300> I learnt that a pipe can be 
problematic. I apologise for my lack of knowledge there; it was fixed 
<https://github.com/freebsd/pkg/commit/fe3031f54b580f54e58fb2c34b12276a947090f8> 
after users of a release suffered the effects of my mistake.


----

Belated thanks to Ed Maste and arrowd 
(<https://github.com/freebsd/pkg/issues/2485#issuecomment-3133273925> 
and <https://github.com/freebsd/pkg/issues/2485#issuecomment-3134915559> 
in particular).