Date: 2 Sep 2005 06:51:18 -0000 From: Luca Morettoni <luca@morettoni.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: cperciva@FreeBSD.org Subject: bin/85619: [patch] allow portsnap to refuse ports categories Message-ID: <20050902065118.81914.qmail@current.morettoni.local> Resent-Message-ID: <200509020700.j8270XPa068737@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 85619 >Category: bin >Synopsis: [patch] allow portsnap to refuse ports categories >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Sep 02 07:00:32 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Luca Morettoni >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD current.morettoni.local 7.0-CURRENT FreeBSD 7.0-CURRENT #289: Mon Aug 22 13:34:21 CEST 2005 luca@current.morettoni.local:/usr/obj/usr/src/sys/FRODO i386 >Description: With this patch you can "refuse" one or more directory (categories) in ports three. Now you can add, into portsnap.conf, a line like this: REFUSE="games cad" In "extract" command listed directory are skipped. In "update" command listed directory are deleted and new (or updated) files inside that are ignored. >How-To-Repeat: >Fix: Apply this patch (into src/usr.sbin/portsnap/portsnap/): --- portsnap.sh-refuse.patch begins here --- *** portsnap.sh-orig Fri Sep 2 08:32:08 2005 --- portsnap.sh Fri Sep 2 08:32:17 2005 *************** *** 81,86 **** --- 81,87 ---- DDSTATS="" INDEXONLY="" SERVERNAME="" + REFUSE="" } # Parse the command line *************** *** 170,181 **** fi } ! # Read {KEYPRINT, SERVERNAME, WORKDIR, PORTSDIR} from the configuration # file if they haven't already been set. If the configuration # file doesn't exist, do nothing. parse_conffile() { if [ -r "${CONFFILE}" ]; then ! for X in KEYPRINT WORKDIR PORTSDIR SERVERNAME; do eval _=\$${X} if [ -z "${_}" ]; then eval ${X}=`grep "^${X}=" "${CONFFILE}" | --- 171,182 ---- fi } ! # Read {KEYPRINT, SERVERNAME, WORKDIR, PORTSDIR, REFUSE} from the configuration # file if they haven't already been set. If the configuration # file doesn't exist, do nothing. parse_conffile() { if [ -r "${CONFFILE}" ]; then ! for X in KEYPRINT WORKDIR PORTSDIR SERVERNAME REFUSE; do eval _=\$${X} if [ -z "${_}" ]; then eval ${X}=`grep "^${X}=" "${CONFFILE}" | *************** *** 193,199 **** _WORKDIR="/var/db/portsnap" _PORTSDIR="/usr/ports" _NDEBUG="-n" ! for X in QUIETREDIR QUIETFLAG STATSREDIR WORKDIR PORTSDIR NDEBUG; do eval _=\$${X} eval __=\$_${X} if [ -z "${_}" ]; then --- 194,201 ---- _WORKDIR="/var/db/portsnap" _PORTSDIR="/usr/ports" _NDEBUG="-n" ! _REFUSE="" ! for X in QUIETREDIR QUIETFLAG STATSREDIR WORKDIR PORTSDIR NDEBUG REFUSE; do eval _=\$${X} eval __=\$_${X} if [ -z "${_}" ]; then *************** *** 771,776 **** --- 773,780 ---- if ! grep "^${EXTRACTPATH}" ${WORKDIR}/INDEX | while read LINE; do FILE=`echo ${LINE} | cut -f 1 -d '|'` HASH=`echo ${LINE} | cut -f 2 -d '|'` + # skip refused ports categories + echo ${REFUSE:-} | grep -q "${FILE%%/*}" && continue echo ${PORTSDIR}/${FILE} if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." *************** *** 779,784 **** --- 783,789 ---- case ${FILE} in */) rm -rf ${PORTSDIR}/${FILE} + mkdir -p ${PORTSDIR}/${FILE} tar -xzf ${WORKDIR}/files/${HASH}.gz \ -C ${PORTSDIR}/${FILE} *************** *** 816,821 **** --- 821,829 ---- echo -n "Removing old files and directories... " sort ${WORKDIR}/INDEX | comm -23 ${PORTSDIR}/.portsnap.INDEX - | cut -f 1 -d '|' | lam -s "${PORTSDIR}/" - | xargs rm -rf + for DIR in ${REFUSE:-}; do + rm -fr ${PORTSDIR}/${DIR} + done echo "done." # Install new files *************** *** 825,830 **** --- 833,840 ---- while read LINE; do FILE=`echo ${LINE} | cut -f 1 -d '|'` HASH=`echo ${LINE} | cut -f 2 -d '|'` + # skip refused ports categories + echo ${REFUSE:-} | grep -q "${FILE%%/*}" && continue echo ${PORTSDIR}/${FILE} if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." --- portsnap.sh-refuse.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050902065118.81914.qmail>