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  [EMAIL PROTECTED]    [EMAIL PROTECTED]    [EMAIL PROTECTED]
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.

Attachment: pgpg6ssd44SFH.pgp
Description: PGP signature

Reply via email to