1999-07-30 05:51:04 +00:00
|
|
|
#!/bin/sh
|
|
|
|
if [ $# != 2 ]; then
|
|
|
|
echo "usage: chopindex <indexfile> <pkgdir>"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
index=$1
|
|
|
|
pkgdir=$2
|
1999-08-18 10:24:53 +00:00
|
|
|
tmpindex=/tmp/index.$$
|
|
|
|
|
|
|
|
# make a list of all pkgnames that don't have corresponding packages
|
|
|
|
missing=$(/usr/bin/awk -v FS="|" -v pkgdir=$pkgdir '{
|
|
|
|
if (system(sprintf("test -e %s/All/%s.tgz\n", pkgdir, $1)))
|
|
|
|
print $1 ;
|
|
|
|
}' $index)
|
|
|
|
|
|
|
|
# make an index for only the ports that have packages
|
1999-07-30 05:51:04 +00:00
|
|
|
/usr/bin/awk -v FS="|" -v pkgdir=$pkgdir '{
|
|
|
|
if (system(sprintf("test ! -e %s/All/%s.tgz\n", pkgdir, $1)))
|
|
|
|
print $0 ;
|
1999-08-18 10:24:53 +00:00
|
|
|
}' $index > $tmpindex
|
|
|
|
|
|
|
|
# find missing ports still in the index as a dependency
|
|
|
|
delete=""
|
|
|
|
sed=""
|
|
|
|
for i in $missing; do
|
2000-07-12 23:29:30 +00:00
|
|
|
if grep -q "[ |]$i[ |]" $tmpindex; then
|
1999-08-18 10:24:53 +00:00
|
|
|
delete="$delete $i"
|
|
|
|
sed="$sed -e s/$(echo $i | sed -e 's/\./\\./g')//g"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# delete them
|
|
|
|
if [ "$delete" != "" ]; then
|
|
|
|
echo "chopindex: deleting" $delete 1>&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed $sed -e 's/ */ /g' -e 's/| /|/g' -e 's/ |/|/g' $tmpindex
|
|
|
|
|
|
|
|
/bin/rm -f $tmpindex
|