Usefulness of pkg_depend command?

Garrett Cooper yanefbsd at gmail.com
Sun Sep 28 06:54:32 UTC 2008


Hi porters,
     Just thinking -- one of the problems with many utilities is
mapping dependencies with installing either packages or ports. Would
there be any interest in a C app (based off the same code in
pkg_install already) in the base system being able to provide
dependency info for a list of ports / pkgs provided, s.t. we could
have a shell script to simply install items in order via the
BUILD_DEPS and RUN_DEPS fields in INDEX files?
     The driving force behind this is that I should be able to do the
following to upgrade my ports / pkgs instead of depending on
complicated infrastructures to do this for me:

#!/bin/sh

for pkg in `pkg_depend -o $@ | grep '<' | cut -d ' ' -f 1`; do
        cd /usr/ports/$pkg || continue
        make clean all || continue
        make deinstall install
done
# END

      I realize that pkg_cutleaves brute forces this logic and
pkg_tree does similar. My point was to implement it in C with existing
logic in pkg_install for both performance reasons and to prevent code
duplication as much as possible.
Thanks,
-Garrett


More information about the freebsd-ports mailing list