FindPage
View Source:
KnowledgeBase/FreeBSD/UpdatePorts
Note:
You are viewing an old version of this page.
View the current version.
Sync ports tree <verbatim> csup ports-supfile </verbatim> Update INDEX <verbatim> portsdb -Uu </verbatim> Get a list of out-of-date ports <verbatim> pkg_version -vl '<' | cut -d' ' -f1 </verbatim> Pull dependency information for each out-of-date port (Children must be rebuilt/reinstalled as well) <verbatim> pkg_info -Rq </verbatim> 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.: <verbatim> A -B -C --D E -B -D =becomes= A E B C D == </verbatim> BASH script: <verbatim> #!/usr/bin/env bash str_repeat() { repeat="${1}" while [ "${repeat}" -gt 0 ] do echo -n "${2}" repeat=$(( ${repeat} - 1)) done } clear_deps() { depth=0 storevar="list_${depth}" eval list=\${${storevar}} while [ -n "${list}" ] do echo "Clearing $storevar" unset $storevar depth=$(( ${depth} + 1 )) storevar="list_${depth}" eval list=\${${storevar}} 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 } 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 } clear_deps resolve_deps 0 $(pkg_version -vl '<' | cut -d' ' -f1) print_deps | sort --key=2 --reverse | uniq -f 1 | sort | cut -f2 </verbatim>