Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Aug 2007 20:32:36 -0500
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        ports@freebsd.org
Subject:   Faster pkg_version
Message-ID:  <46B13434.9010301@math.missouri.edu>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010809090309040608080400
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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.




--------------010809090309040608080400
Content-Type: text/plain;
 name="pkg-version-quick"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pkg-version-quick"

#!/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

--------------010809090309040608080400--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46B13434.9010301>