Faster pkg_version

Stephen Montgomery-Smith stephen at math.missouri.edu
Thu Aug 2 02:56:30 UTC 2007


Stephen Montgomery-Smith wrote:
> 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.

Someone emailed me that it didn't work on their system.  Try this one 
instead.  I also corrected a few other potential issues (like if you run 
my script as root and then press control C, you might mess up your 
database).




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

PKG_DBDIR?=/var/db/pkg
PORTSDIR?=/usr/ports

PKG_LIST!= \
	for p in ${PKG_DBDIR}/*/+CONTENTS; do \
		sed -n "s|@comment ORIGIN|$$p|p" $$p; \
	done

all:	${PKG_LIST:C/:.*//}

.for target in ${PKG_LIST}
${target:C/:.*//}::	${PORTSDIR}/${target:C/.*://}/Makefile
	@pkg_version -L'=' -v -s ${target:C|${PKG_DBDIR}/(.*)/\+CONTENTS:.*|\1|}
.endfor


More information about the freebsd-ports mailing list