blob: 0b59a294049e4ab33c0a6b56059bab2ed86e32c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/sh
if [ $# != 2 ]; then
echo "usage: chopindex <indexfile> <pkgdir>"
return 1
fi
index=$1
pkgdir=$2
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.t[bg]z\n", pkgdir, $1)))
print $1 ;
}' $index)
# make an index for only the ports that have packages
/usr/bin/awk -v FS="|" -v pkgdir=$pkgdir '{
if (system(sprintf("test ! -e %s/All/%s.t[bg]z\n", pkgdir, $1)))
print $0 ;
}' $index > $tmpindex
# find missing ports still in the index as a dependency
delete=""
sed=""
for i in $missing; do
if grep -q "[ |]$i[ |]" $tmpindex; then
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
|