How to check dependencies of a package under OpenBSD

openbsdpackage-management

AFAIK this is the way that I can install for ex.: XYZ on OpenBSD:

pkg_add -Uvi XYZ

How can I get a list for all the dependencies regarding XYZ package?

-> So I need a list about .tgz filenames that pkg_add will download/install/update when I need to install given XYZ package.

What is the command to generate a list for XYZ package?

Best Answer

Looks like dependencies are specified in the packing list. You can see the packing list with pkg_info -f.

So, assuming PKG_PATH is already set:

pkg_info -f XYZ | grep '^@depend' | cut -f 3 -d :

should give you the package names.

Prepending $PKG_PATH and appending .tgz to each line should give you a URL that's probably what would be downloaded, e.g. to get bash's dependencies:

PKG_PATH=http://ftp3.usa.openbsd.org/pub/OpenBSD/5.1/packages/amd64/
export PKG_PATH
pkg_info -f bash | grep '@depend' | cut -f 3 -d : | while read package; do
    echo $PKG_PATH$package.tgz
done

prints

http://ftp3.usa.openbsd.org/pub/OpenBSD/5.1/packages/amd64/libiconv-1.14.tgz
http://ftp3.usa.openbsd.org/pub/OpenBSD/5.1/packages/amd64/gettext-0.18.1p1.tgz

See also pkg_add -n and PKG_CACHE.

References:

Related Question