Sync ports tree
csup ports-supfile
Update INDEX
portsdb -Uu
Get a list of out-of-date ports
pkg_version -vl '<' | cut -d' ' -f1
Pull dependency information for each out-of-date port (Children must be rebuilt/reinstalled as well)
pkg_info -Rq
Do this recursively, keeping track of the depth. Once you hit bottom on all the ports and their descendants, squash the depgraph, placing deeper dependencies later. I.e.:
A -B -C --D E -B -D =becomes= A E B C D ==
BASH script:
#!/usr/bin/env bash str_repeat() { repeat="${1}" while [ "${repeat}" -gt 0 ] do echo -n "${2}" repeat=$(( ${repeat} - 1)) done } resolve_deps(){ depth="${1}" storevar="list_${depth}" shift while [ -n "${1}" ] do str_repeat ${depth} - echo "${1}" eval ${storevar}="\"\${${storevar}} ${1}\"" deps=$(pkg_info -Rq "${1}" | sed -e '/^$/d') if [ -n "${deps}" ] then resolve_deps $(( ${depth} + 1 )) ${deps} depth=$(( ${depth} - 1 )) storevar="list_${depth}" fi shift done } function print_deps() { depth=0 storevar="$(printf "list_%u" "${depth}")" eval list=\${${storevar}} while [ -n "${list}" ] do for item in ${list} do printf "%u\t%s\n" "${depth}" "${item}" done depth=$(( ${depth} + 1 )) storevar="list_${depth}" eval list=\${${storevar}} done } resolve_deps 0 $(pkg_version -vl '<' | cut -d' ' -f1) print_deps | sort --key=2 --reverse | uniq -f 1 | sort | cut -f2