summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2008-05-17 16:26:27 +0000
committercperciva <cperciva@FreeBSD.org>2008-05-17 16:26:27 +0000
commit55aafae3bb6d6ee7a99322fa2cc2488709b72731 (patch)
treed38adb51ebd1ad3da67e3338b78a019713ea4442
parentc890e8f252f916ae5f70c91e56e558be15390f18 (diff)
downloadFreeBSD-src-55aafae3bb6d6ee7a99322fa2cc2488709b72731.zip
FreeBSD-src-55aafae3bb6d6ee7a99322fa2cc2488709b72731.tar.gz
Add support for specifying which INDEX files to build via portsnap.conf.
Requested by: brooks Reminded by: brooks, about halfway through his BSDCan talk
-rw-r--r--etc/portsnap.conf5
-rw-r--r--share/man/man5/portsnap.conf.57
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.sh20
3 files changed, 28 insertions, 4 deletions
diff --git a/etc/portsnap.conf b/etc/portsnap.conf
index 4a6609d..052d554 100644
--- a/etc/portsnap.conf
+++ b/etc/portsnap.conf
@@ -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
diff --git a/share/man/man5/portsnap.conf.5 b/share/man/man5/portsnap.conf.5
index 9204e83..b936d98 100644
--- a/share/man/man5/portsnap.conf.5
+++ b/share/man/man5/portsnap.conf.5
@@ -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
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh
index 7d7a2d1..0660b41 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.sh
+++ b/usr.sbin/portsnap/portsnap/portsnap.sh
@@ -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."
}
OpenPOWER on IntegriCloud