Remarks on the --optional feature of pactree

Sebastian Jakubiak jakseb.dev at gmail.com
Thu Jul 30 23:40:42 UTC 2020


Hello,

I would like to share my thoughts on how `pactree --optional` works.

First thing: shouldn't it omit uninstalled optional dependencies when
asked to query the local database (no -s/--sync)? There was a comment by
Johannes Löthberg on an earlier attempt to implement --optional:

> The problem is that while it works fine for -so, when searching for
> local packages it should properly exclude optional dependencies that are
> not installed so they're not printed, rather than being printed as
> unresolvable.

(source: https://lists.archlinux.org/pipermail/pacman-contrib/2020-May/000274.html)

So for example here:

    $ pactree -d1 -o python2-urllib3
    python2-urllib3
    ├─python2
    ├─python2-pysocks: SOCKS support [unresolvable] (optional)
    └─python2-pyopenssl provides python2-pyopenssl: security support (optional)

python2-pysocks should be skipped, shouldn't it?

Second: default value of DEPTH (optional argument of -o/--optional). I
think that infinity (-1) would have been a better choice than 1. In
other words, no depth specified should mean no depth limiting. The
function of the switch could then be described like so:

    --optional[=DEPTH]  also list optional dependencies, optionally
                        stopping at DEPTH

This would be kind of analogous to how 'normal' depth works -- unlimited
unless --depth=N is passed. Also, it may sound silly but -o1 feels
slightly easier to type if need be / looks less strange than -o-1.

But I guess that other people's views on this matter might differ from
mine. Plus, it is maybe too late anyway to change the behavior of the
feature since a release containing it has been made. I should have
raised my concerns earlier.


More information about the pacman-contrib mailing list