Welcome to CRUX bug tracking.

FS#1848 - pkgmk: support Tim Biermann's flexibility

Attached to Project: CRUX
Opened by Steffen Nurpmeso (steffen) - Friday, 05 February 2021, 21:41 GMT
Task Type Feature Request
Category tools → pkgutils
Status New
Assigned To No-one
Operating System CRUX
Severity Low
Priority Normal
Reported Version 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


Tim uses patterns like

[[ -e /usr/lib/cups ]] && PKGMK_BLUEZ+=" --enable-cups" || PKGMK_BLUEZ+=" --disable-cups"

in Pkgfile's. This is both a bashism and stricken.
Instead it would be nice to have a regular way of doing this, via an

isinst() { pkginfo -i | grep -qE "^${1}[[:space:]]"; }

that comes for free as part of pkgmk.
If i find time i could offer the already existing functionality of "is-installed" via pkginfo -I, then the above could become

isinst() { pkginfo -I "${1}"; }
This task depends upon

Comment by Steffen Nurpmeso (steffen) - Thursday, 18 February 2021, 22:21 GMT
jue, how about this patch -- seems to work (at least pkginfo -I BLA)
Comment by Tim Biermann (tb) - Saturday, 27 February 2021, 10:24 GMT
pkginfo -I works great for me. Also glad I can be inspiration, too :D
Comment by Steffen Nurpmeso (steffen) - Saturday, 27 February 2021, 17:57 GMT
Needs to be upstream to be usable though :)
Comment by Juergen Daubert (jue) - Monday, 01 March 2021, 09:19 GMT
Not sure if 'prt-get isinst <port>' isn't everything we need? TBH I don't understand why one would test for single files to see if a package is intallled?
Comment by Tim Biermann (tb) - Monday, 01 March 2021, 12:02 GMT
For example to check if a certain extension of a port is installed, harfbuzz-icu or pulseaudio-glib :)
Comment by Juergen Daubert (jue) - Monday, 01 March 2021, 16:31 GMT
Looks like a corner case to me. In most ports, even in the example above, a 'prt-get isinst >port>' is the prefered way to go, IMO.
Even though the new new option (-I) for pkginfo is fine, to have a isinst-command with pure pkgutils.
Comment by Steffen Nurpmeso (steffen) - Monday, 01 March 2021, 20:23 GMT
"prt-get isinst" ok, but pkg stands for itself i would say. (I would understand if prt-get isinst would use pkginfo -I :)
Comment by Steffen Nurpmeso (steffen) - Monday, 01 March 2021, 20:26 GMT
pkginfo -I does not do alias expansion, as aliases are a prt-get thing. (I do not actually use aliases.)