HomeFreeBSD

Mk/bsd.port.{subdir}.mk: create describe-json

Description

Mk/bsd.port.{subdir}.mk: create describe-json

Summary:
Create "describe-json" target to get a JSON-compliant representation of the
ports tree.

It can be invoked from a single port directory, a category directory or from the
ports tree top directory.

It supports FLAVORS. E.g. It is possible to execute the following:

cd math/qalculate-qt && make describe-json-qt6

Performance-wise it is equivalent to a simple "make describe" although it
offers a more complete vision of the port in an easily parseable format.

Times for describe:

1345.39 real       933.06 user       403.01 sys
1317.00 real       929.22 user       406.43 sys
1316.83 real       930.82 user       404.70 sys
1316.75 real       928.05 user       407.39 sys
1316.58 real       930.69 user       404.59 sys

Times for describe-json:

1320.38 real       924.80 user       414.48 sys
1320.66 real       926.14 user       413.41 sys
1320.41 real       924.08 user       415.30 sys
1320.37 real       922.96 user       416.35 sys
1320.25 real       924.25 user       414.95 sys

Some examples assuming the output is saved in the describe.json file.

Show all ports in the "accessibility" category:

jq '.accessibility' describe.json

Show ports in the "accessibility" category with a USES=iconv dependency:

jq '.accessibility.[] | select(.uses | index("iconv")) | .pkgorigin' describe.json

Show ports in the tree that Uses=kmod:

jq '.[].[] | select(.uses | index("kmod")) | .pkgorigin' describe.json

Show ports having a LIB_DEPENDS on devel/binutils:

jq '.[].[] | select(.lib_depends | map(test("devel/binutils")) | any) | .pkgorigin' describe.json

Show ports in the "database" category which have no maintainer and are marked as
deprecated:

jq '.databases.[] | select(.maintainer=="ports@FreeBSD.org" and .deprecated!=" ") | .pkgorigin, .deprecated' describe.json

Approved by: portmgr (bapt@)
Differential Revision: https://reviews.freebsd.org/D42131

Details

Provenance
fernapeAuthored on Sep 27 2023, 3:32 PM
Differential Revision
D42131: Mk/bsd.port.{subdir}.mk: create describe-json
Parents
R11:dcfd94ae420a: devel/busd: add new port
Branches
Unknown
Tags
Unknown