[PATCH] pactree: Compress self-provided optional dependencies
Eli Schwartz
eschwartz at archlinux.org
Fri Jul 31 17:53:17 UTC 2020
On 7/31/20 12:00 PM, Sebastian Jakubiak wrote:
> Remove `provides X` from `X provides X: ...` lines describing optional
> dependencies to make the output more compact.
>
> Signed-off-by: Sebastian Jakubiak <jakseb.dev at gmail.com>
> ---
> I noticed that most optional dependencies in the output of `pactree
> --optional` have this unneeded repetition. With this patch the
> following:
>
> vim-runtime
> ├─bash provides sh: support for some tools and macros (optional)
> ├─python provides python: demoserver example tool (optional)
> └─gawk provides gawk: mve tools upport (optional)
>
> will change to:
>
> vim-runtime
> ├─bash provides sh: support for some tools and macros (optional)
> ├─python: demoserver example tool (optional)
> └─gawk: mve tools upport (optional)
Just for the record: these don't "provide themselves" at all. However,
pactree might not distinguish between matching on the package name vs.
matching on the package provides, since either one is a route to a valid
*satisfier*.
Looking at pactree.c the "provision" variable in print_text starts life as:
dep_pkg = alpm_dbs_find_satisfier()
->
depname = alpm_pkg_get_name(dep_pkg)
...
The "pkg_provides_itself" function name sounds weird, and furthermore
seems to be a *fix* for
strcmp(pkg, provision) != 0
not performing its intended purpose since provision can be a freeform
string containing e.g. descriptions. (The comment message should specify
this, rather than implying it adds a new functionality.)
I think you should instead use alpm_dep_from_string to turn the
provision string into something you can get a properly formatted name
from. Essentially reversing the work from get_pkg_deps.
--
Eli Schwartz
Bug Wrangler and Trusted User
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-contrib/attachments/20200731/71c51d77/attachment.sig>
More information about the pacman-contrib
mailing list