From owner-freebsd-bugs@FreeBSD.ORG Fri Sep 2 07:00:35 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E58216A41F for ; Fri, 2 Sep 2005 07:00:35 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6797743D48 for ; Fri, 2 Sep 2005 07:00:34 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8270XVW068741 for ; Fri, 2 Sep 2005 07:00:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8270XPa068737; Fri, 2 Sep 2005 07:00:33 GMT (envelope-from gnats) Resent-Date: Fri, 2 Sep 2005 07:00:33 GMT Resent-Message-Id: <200509020700.j8270XPa068737@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Luca Morettoni Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 81CA216A41F for ; Fri, 2 Sep 2005 06:50:35 +0000 (GMT) (envelope-from luca@morettoni.net) Received: from smtp20.libero.it (smtp20.libero.it [193.70.192.147]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F51D43D46 for ; Fri, 2 Sep 2005 06:50:34 +0000 (GMT) (envelope-from luca@morettoni.net) Received: from current.morettoni.local (151.38.48.209) by smtp20.libero.it (7.0.027-DD01) id 42F2CBAB006E71E7 for FreeBSD-gnats-submit@freebsd.org; Fri, 2 Sep 2005 08:50:33 +0200 Received: (qmail 81915 invoked by uid 0); 2 Sep 2005 06:51:18 -0000 Message-Id: <20050902065118.81914.qmail@current.morettoni.local> Date: 2 Sep 2005 06:51:18 -0000 From: Luca Morettoni To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: cperciva@FreeBSD.org Subject: bin/85619: [patch] allow portsnap to refuse ports categories X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Luca Morettoni List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2005 07:00:35 -0000 >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: