Add support for specifying which INDEX files to build via portsnap.conf.

Requested by:	brooks
Reminded by:	brooks, about halfway through his BSDCan talk
This commit is contained in:
cperciva 2008-05-17 16:26:27 +00:00
parent c890e8f252
commit 55aafae3bb
3 changed files with 28 additions and 4 deletions

View File

@ -28,3 +28,8 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3aede40c98633216c330
#
# REFUSE arabic chinese french german hebrew hungarian japanese
# REFUSE korean polish portuguese russian ukrainian vietnamese
# List of INDEX files to build and the DESCRIBE file to use for each
INDEX INDEX-5 DESCRIBE.5
INDEX INDEX-6 DESCRIBE.6
INDEX INDEX-7 DESCRIBE.7

View File

@ -89,6 +89,13 @@ If more than one line of any of the above forms is included in
.Nm
then only the last one will take effect.
.Pp
A line of the form
.Dl INDEX INDEXFILE DESCRIBEFILE
will instruct
.Xr portsnap 8
that the specified INDEX file is generated from the specified
describe file distributed by the portsnap server.
.Pp
Finally, a line of the form
.Dl REFUSE foo bar
will instruct

View File

@ -199,6 +199,12 @@ parse_conffile() {
cut -c 7- | xargs echo | tr ' ' '|'
`)"
fi
if grep -qE "^INDEX[[:space:]]" ${CONFFILE}; then
INDEXPAIRS="`
grep -E "^INDEX[[:space:]]" "${CONFFILE}" |
cut -c 7- | tr ' ' '|' | xargs echo`"
fi
fi
}
@ -829,19 +835,25 @@ fetch_run() {
# Build a ports INDEX file
extract_make_index() {
if ! look $1 ${WORKDIR}/tINDEX > /dev/null; then
echo -n "$1 not provided by portsnap server; "
echo "$2 not being generated."
else
gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX |
cut -f 2 -d '|'`.gz" |
cat - ${LOCALDESC} |
${MKINDEX} /dev/stdin > ${PORTSDIR}/$2
fi
}
# Create INDEX, INDEX-5, INDEX-6
extract_indices() {
echo -n "Building new INDEX files... "
extract_make_index DESCRIBE.4 INDEX || return 1
extract_make_index DESCRIBE.5 INDEX-5 || return 1
extract_make_index DESCRIBE.6 INDEX-6 || return 1
extract_make_index DESCRIBE.7 INDEX-7 || return 1
for PAIR in ${INDEXPAIRS}; do
INDEXFILE=`echo ${PAIR} | cut -f 1 -d '|'`
DESCRIBEFILE=`echo ${PAIR} | cut -f 2 -d '|'`
extract_make_index ${DESCRIBEFILE} ${INDEXFILE} || return 1
done
echo "done."
}