From d600d37002eb56328a6f14cddd6b18adc928828a Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Sat, 13 May 2006 15:56:35 +0000 Subject: [PATCH] Add a mechanism for constructing INDEX files which include local ports. Requested by: brooks --- usr.sbin/portsnap/portsnap/portsnap.8 | 9 +++++++++ usr.sbin/portsnap/portsnap/portsnap.sh | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/usr.sbin/portsnap/portsnap/portsnap.8 b/usr.sbin/portsnap/portsnap/portsnap.8 index c5011f77b9f4..5ef3ea7bad7f 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.8 +++ b/usr.sbin/portsnap/portsnap/portsnap.8 @@ -37,6 +37,7 @@ .Op Fl d Ar workdir .Op Fl f Ar conffile .Op Fl k Ar KEY +.Op Fl l Ar descfile .Op Fl p Ar portsdir .Op Fl s Ar server .Cm command ... @@ -70,6 +71,14 @@ command, update INDEX files, but not the rest of the ports tree. .It Fl k Ar KEY Expect a public key with given SHA256 hash. (default: read value from configuration file.) +.It Fl l Ar descfile +Merge the specified lcoal describes file into the INDEX files being +built. +The +.Ar descfile +should be generated by running +.Cm make describe +in each of the local port directories. .It Fl p Ar portsdir When extracting or updating an uncompressed snapshot, operate on the directory diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index c730ad4f6b50..d74190f7b0a5 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -43,6 +43,7 @@ Options: (default: /etc/portsnap.conf) -I -- Update INDEX only. (update command only) -k KEY -- Trust an RSA key with SHA256 hash of KEY + -l descfile -- Merge the specified local describes file into the INDEX. -p portsdir -- Location of uncompressed ports tree (default: /usr/ports/) -s server -- Server from which to fetch updates. @@ -82,6 +83,7 @@ init_params() { INDEXONLY="" SERVERNAME="" REFUSE="" + LOCALDESC="" } # Parse the command line @@ -117,6 +119,11 @@ parse_cmdline() { if [ ! -z "${KEYPRINT}" ]; then usage; fi shift; KEYPRINT="$1" ;; + -l) + if [ $# -eq 1 ]; then usage; fi + if [ ! -z "${LOCALDESC}" ]; then usage; fi + shift; LOCALDESC="$1" + ;; --no-stats) if [ -z "${STATSREDIR}" ]; then STATSREDIR="/dev/null" @@ -203,7 +210,9 @@ default_params() { _WORKDIR="/var/db/portsnap" _PORTSDIR="/usr/ports" _NDEBUG="-n" - for X in QUIETREDIR QUIETFLAG STATSREDIR WORKDIR PORTSDIR NDEBUG; do + _LOCALDESC="/dev/null" + for X in QUIETREDIR QUIETFLAG STATSREDIR WORKDIR PORTSDIR \ + NDEBUG LOCALDESC; do eval _=\$${X} eval __=\$_${X} if [ -z "${_}" ]; then @@ -821,7 +830,9 @@ fetch_run() { # Build a ports INDEX file extract_make_index() { gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | - cut -f 2 -d '|'`.gz" | ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2 + cut -f 2 -d '|'`.gz" | + cat - ${LOCALDESC} | + ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2 } # Create INDEX, INDEX-5, INDEX-6