From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Nov 28 16:50:07 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CCF8816A4C8 for ; Tue, 28 Nov 2006 16:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id B31E943CA1 for ; Tue, 28 Nov 2006 16:50:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kASGo5fw099619 for ; Tue, 28 Nov 2006 16:50:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kASGo5Ka099612; Tue, 28 Nov 2006 16:50:05 GMT (envelope-from gnats) Resent-Date: Tue, 28 Nov 2006 16:50:05 GMT Resent-Message-Id: <200611281650.kASGo5Ka099612@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Frank J. Laszlo" Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D17916A6B3 for ; Tue, 28 Nov 2006 16:49:43 +0000 (UTC) (envelope-from laszlof@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80BB243CD0 for ; Tue, 28 Nov 2006 16:49:31 +0000 (GMT) (envelope-from laszlof@FreeBSD.org) Received: from freefall.freebsd.org (laszlof@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kASGnYP4097404 for ; Tue, 28 Nov 2006 16:49:34 GMT (envelope-from laszlof@freefall.freebsd.org) Received: (from laszlof@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kASGnYoX097398; Tue, 28 Nov 2006 16:49:34 GMT (envelope-from laszlof) Message-Id: <200611281649.kASGnYoX097398@freefall.freebsd.org> Date: Tue, 28 Nov 2006 16:49:34 GMT From: "Frank J. Laszlo" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/105958: [PATCH]: Mk/bsd.port.mk: Add support for CONF_FILES X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Frank J. Laszlo" List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2006 16:50:07 -0000 >Number: 105958 >Category: ports >Synopsis: [PATCH]: Mk/bsd.port.mk: Add support for CONF_FILES >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Nov 28 16:50:05 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Frank J. Laszlo >Release: FreeBSD 6.0-STABLE i386 >Organization: >Environment: System: FreeBSD freefall.freebsd.org 6.0-STABLE FreeBSD 6.0-STABLE #0: Sat Dec 10 03:18:20 UTC 2005 kensmith@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386 >Description: The amount of ports that use: "@unexec if cmp -s %D/etc/foo.conf.sample %D/etc/foo.conf; then rm -f %D/foo.conf; fi" is getting quite large. I believe its about time that this be handled in a much simpler fashion. I propose adding 2 knobs. CONF_FILES and DEF_CONF_SUFFIX. CONF_FILES will contain files, relative to PREFIX, that should not be removed if they are modified from the original. Most commonly this is done with config files. We do this by comparing the installed .conf file with a .sample (default) version of the same file. DEF_CONF_SUFFIX is the suffix to use for the default configuration. In most cases this will be .sample, .dist, -dist, or .default. I have set it to .sample by default, as this seems to be the most common. This should not affect any currently installed ports, and only serves as a simpler way of get around the previous @unexec command. >How-To-Repeat: >Fix: --- bsd.port.mk-CONF_FILES.diff begins here --- Index: bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.544 diff -u -r1.544 bsd.port.mk --- bsd.port.mk 30 Sep 2006 19:25:45 -0000 1.544 +++ bsd.port.mk 28 Nov 2006 16:41:48 -0000 @@ -857,6 +857,15 @@ # MTREE_FILE - The name of the mtree file. # Default: /etc/mtree/BSD.x11.dist if USE_X_PREFIX is set, # /etc/mtree/BSD.local.dist otherwise. +# CONF_FILES - This directive should be used to define config files +# installed by a port. The associated default config file should +# also exist and be installed. (DEF_CONF_SUFFIX) Files here are +# relative to PREFIX. This is the equivalent of: +# @unexec if cmp -s %D/etc/foo.conf.sample %D/etc/foo.conf; then +# rm -f %D/etc/foo.conf; fi +# DEF_CONF_SUFFIX +# - Filename suffix for the default CONF_FILES. +# Default: .sample # PLIST_DIRS - Directories to be added to packing list # PLIST_FILES - Files and symbolic links to be added to packing list # @@ -5419,6 +5428,16 @@ done @${ECHO_CMD} '@cwd ${PREFIX}' >> ${TMPPLIST} .endif + +.if !defined(DEF_CONF_SUFFIX) + DEF_CONF_SUFFIX= .sample +.endif +.if defined(CONF_FILES) + @for i in ${CONF_FILES}; do \ + ${ECHO_CMD} "@unexec if cmp -s %D/$${i}${DEF_CONF_SUFFIX} %D/$${i}; then rm -f %D/$${i}; fi" >> ${TMPPLIST}; \ + ${ECHO_CMD} "@unexec rm -f %D/$${i}${DEF_CONF_SUFFIX}" >> ${TMPPLIST}; \ + done +.endif @for i in $$(${ECHO_CMD} ${__MANPAGES} ${_TMLINKS:M${_PREFIX}*:S|^${_PREFIX}/||} ' ' | ${SED} -E -e 's|man([1-9ln])/([^/ ]+) |cat\1/\2 |g'); do \ ${ECHO_CMD} "@unexec rm -f %D/$${i%.gz} %D/$${i%.gz}.gz" >> ${TMPPLIST}; \ done --- bsd.port.mk-CONF_FILES.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: