qlist bugs 1. does not populate %{USE} correctly in format templates. 2. hard-append USE flags onto output if -U is passed, breaking format template output. commands: # qlist -CIvSR -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%{USE}"}' portage-utils # qlist -CIvSRU -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%{USE}"}' portage-utils actual output: {"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"["} {"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"["} -libressl -nls openmp qmanifest qtegrity -static expected output {"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"-libressl -nls openmp qmanifest qtegrity -static"]} {"cp": "app-portage/portage-utils", "pv":"0.80", pvr:"0.80-r0", slot: "0", subslot:"", repo:"gentoo", use:"-libressl -nls openmp qmanifest qtegrity -static"]} P.S.: The bug filing in README tells uses to file to Portage Development/Tools, but the Tools component doesn't seem to available for new bug reports.
This is an interesting case. Thanks, will review the README directions too.
Ok, just to clarify what happens here. qlist -U adds a list of USE-flags enabled for the package after printing the package, that is, the string as given in -F. qlist -vU adds a list of all USE-flags, and flags those not enabled by prefixing them with a '-'. The %{USE} formatter in -F would print the USE-dependencies specified for the atom. E.g. this is what would be found in a dependency string: foo/bar-4[-fnord,ssl:=] For example: % ./qatom -F '{"cp": "%{CAT}/%{PN}", "pv":"%{PV}", pvr:"%{PVR}", slot: "%{SLOT}", subslot:"%[SUBSLOT]", repo:"%{REPO}", use:"%[USE]"}' "foo/bar-4[-fnord,ssl:=]" {"cp": "foo/bar", "pv":"4", pvr:"4", slot: "<unset>", subslot:"", repo:"<unset>", use:"-fnord ssl:="} What you seem to have found is that %{USE} always prints the starting '[', but doesn't bother to close it if there's no USE-deps specified. That needs fixing, both your queries should show an empty expansion when used with [] and "<unset>" when used with {}. What you seem to want to do, is not just possible with qlist right now. It seems currently a separate step is required.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a68b9b4ebc840805f504fe681196e7f15737985d commit a68b9b4ebc840805f504fe681196e7f15737985d Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2020-05-25 11:03:36 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2020-05-25 11:03:36 +0000 libq/atom: fixup USE-dep printing in atom_format Bug: https://bugs.gentoo.org/724892 Signed-off-by: Fabian Groffen <grobian@gentoo.org> libq/atom.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)