#!/bin/sh
#
# sanity check and pre-process a per-arch blacklist.  Include per-tier-2 miscellany as well.
#

. ./common.sh

BLACKLIST=${CONTROLDIR}/blacklist
TMPFILE=${BLACKLIST}.tmp

cat > ${TMPFILE} << EOF
#
# AUTOMATICALLY GENERATED FILE -- DO NOT EDIT
#
# generated by $0 `date`
#
EOF

blacklist=`cat ${BLACKLIST}.* | grep -v "^#" | sort | uniq`
for blacklisted in $blacklist; do
  if [ ! -d $PORTSDIR/$blacklisted ]; then
    echo "$0: cannot find alleged port $PORTSDIR/$blacklisted as cited in ${BLACKLIST}!"
  else
    echo $blacklisted >> ${TMPFILE}
  fi
done

mv ${TMPFILE} ${BLACKLIST}
echo "`grep -v \"^#\" ${BLACKLIST} | wc -l` files in ${BLACKLIST}"
