On Fri Jun 05, 2026 at 12:24:01PM +0200, Kirill A. Korinsky wrote:
> ports@,
>
> it is changes in base, but I think pkg_add is more related to ports@, so
> I've used that mail list.
>
> I'd like to let pkg_add -Iunx report which packages would be updated, so
> scripted dry run checks no longer need progress meter output.
>
> I have in /etc/daily.local pkg_add -un like check to catch outdated
> packages.
>
> Current pkg_add needs -Iunm and some "magic" to strip progress bar and ESC
> codes from output to be useful.
>
> Suggested version needs only pkg_add -Iunx | grep -v ^quirks-
>
> Also, while here, clarify in pkg_add(1) that -I only disables prompts and
> that -n reports package additions or updates because that required to read
> the code to understand.
>
> Thoughts? Ok?
+1!
>
> Index: usr.sbin/pkg_add/pkg_add.1
> ===================================================================
> RCS file: /home/cvs/src/usr.sbin/pkg_add/pkg_add.1,v
> diff -u -p -r1.170 pkg_add.1
> --- usr.sbin/pkg_add/pkg_add.1 22 May 2025 01:40:21 -0000 1.170
> +++ usr.sbin/pkg_add/pkg_add.1 4 Jun 2026 20:53:16 -0000
> @@ -374,7 +374,10 @@ which is more discriminating.
> Force update even if dependencies no longer match.
> .El
> .It Fl I
> -Force non-interactive mode.
> +Force non-interactive mode, disabling prompts.
> +This does not affect progress meter output; use
> +.Fl x
> +to disable it.
> Default is to be interactive when run from a tty.
> .It Fl i
> Force interactive mode, even if not run from a tty.
> @@ -416,8 +419,8 @@ Causes
> .Nm
> to always display the progress meter in cases it would not do so by default.
> .It Fl n
> -Don't actually install a package, just report the steps that
> -would be taken if it was.
> +Don't actually install a package, just report package additions or updates
> +that would be performed.
> Will still copy packages to
> .Ev PKG_CACHE
> if applicable.
> Index: usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
> ===================================================================
> RCS file: /home/cvs/src/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm,v
> diff -u -p -r1.152 PkgAdd.pm
> --- usr.sbin/pkg_add/OpenBSD/PkgAdd.pm 6 May 2025 18:36:20 -0000
> 1.152
> +++ usr.sbin/pkg_add/OpenBSD/PkgAdd.pm 4 Jun 2026 20:45:49 -0000
> @@ -831,8 +831,12 @@ sub really_add($set, $state)
> $set, $state));
> }
> });
> - $set->setup_header($state);
> - $state->progress->next($state->ntogo(-1));
> + my $shown = $set->setup_header($state);
> + my $todo = $state->ntogo(-1);
> + $state->progress->next($todo);
> + if ($state->{not} && !$shown) {
> + $state->say("#1: #2", $state->{setheader}, $todo);
> + }
> for my $handle ($set->newer) {
> my $pkgname = $handle->pkgname;
> my $plist = $handle->plist;
>
> --
> wbr, Kirill
>