Cleaning /var/db/ports

Peter Pentchev roam at ringlet.net
Wed Mar 26 02:58:24 PDT 2008


On Tue, Mar 25, 2008 at 05:30:18PM -0700, Doug Barton wrote:
> Lars Stokholm wrote:
>> Apart from doing 'rm -r /var/db/ports/*' is there a way of cleaning the 
>> folder of stale folders and files?
> 
> Not an automated one, no. It would also be somewhat difficult (although not 
> impossible) to write an automated tool to do it because of the loose 
> relationship between the names in /var/db/ports and the names in 
> /var/db/pkg.

Or maybe it's not that difficult, just a bit time-consuming (for the tool,
not the writer :)) - it's just a Simple Matter Of Scripting(tm) something
like:

cd /var/db/pkg
for p in *; do
	if [ -d "$p" ] && [ -f "$p/+CONTENTS" ]; then
		o=`awk -F: '$1 = /@comment ORIGIN/ {print $2}' "$p/+CONTENTS"`
		n=`make -C "/usr/ports/$o" -V UNIQUENAME`
		printf '%s:%s:%s\n' "$p" "$o" "$n"
	fi
done

G'luck,
Peter

-- 
Peter Pentchev	roam at ringlet.net    roam at cnsys.bg    roam at FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I am not the subject of this sentence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20080326/5b110719/attachment.pgp


More information about the freebsd-ports mailing list