config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit f6b091c5e0fb1b394f23a5fc583e27386d74d31d
parent b302f6ee196f58a40c3b2b587fda6ee254234076
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu,  4 Mar 2021 21:08:05 -0800

Add OpenBSD pkg_depends shell function

This function lists the dependancies of the given packages. It uses
pkg_info(1) instead of the `/var/db/pkg/*/+REQUIRING' files to allow
for future changes to the package structure and so package names
are interpreted as one would expect.

I'm surprised there isn't such a thing built into pkg_info(1) itself,
maybe it does and I just missed it.

Diffstat:
Mlocal/shell/.config/shell/openbsd | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/local/shell/.config/shell/openbsd b/local/shell/.config/shell/openbsd @@ -10,3 +10,9 @@ pi() pkg_info "$@" pl() pkg_locate "${@:-.}" pq() { cut -d'|' -f1,4 /usr/local/share/ports-INDEX | tr '|' '\t' | egrep "${@:-.}"; } pu() doas pkg_add -u "$@" + +pkg_depends() { + pkg_info -qv "${@:?No package}" | awk -vOFS='\t' -F'[ :]' \ +'/^@name/ { name = $2 } +/^@depend/ { print name, $NF }' +}