Faster pkg_version

Stephen Montgomery-Smith stephen at math.missouri.edu
Thu Aug 2 01:32:37 UTC 2007


Here is my next attempt to make a faster pkg_version.  This script is 
not going to be 100% reliable, but it should work most of the time.  It 
works by first checking the time difference between 
/var/db/pkg/*/+CONTENTS and /usr/ports/*/*/Makefile, and only invokes 
pkg_version if the former is older.



-------------- next part --------------
#!/usr/bin/make -f

DB=/var/db/pkg
PORTS=/usr/ports

PKG_LIST!=cd ${DB}; \
	for p in *; do \
		sed -n -E "s/@comment ORIGIN/$$p/p" ${DB}/$$p/+CONTENTS; \
	done
ALL_LIST=${PKG_LIST:C=(.*):.*=${DB}/\1/+CONTENTS=}

all:	${ALL_LIST}

.for target in ${PKG_LIST}
${DB}/${target:C/:.*//}/+CONTENTS:	${PORTS}/${target:C/.*://}/Makefile
	@pkg_version -L'=' -v -s ${target:C/:.*//}
.endfor


More information about the freebsd-ports mailing list