From owner-freebsd-ports@FreeBSD.ORG Mon May 16 19:08:59 2011 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E96106564A; Mon, 16 May 2011 19:08:59 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bw0-f45.google.com (mail-bw0-f45.google.com [209.85.214.45]) by mx1.freebsd.org (Postfix) with ESMTP id 70F958FC08; Mon, 16 May 2011 19:08:58 +0000 (UTC) Received: by bwz16 with SMTP id 16so6075200bwz.18 for ; Mon, 16 May 2011 12:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=7/0TYlcdKQhTkoAJyigCI7NyWkrKDVajmCeW3ErmVFQ=; b=K2MsJotkWyKjYV7UDYqKDVPZMhnGR7aL1TQZaIkbmw3WTXv4CkO4LcQDhzMVB25O8x +lZD6N1Zm3yW68PLezL20aQyzG+VaC5dCv+WphacLIzYlhf4KM5vnwnIoK0d/AFEYX5m hZ2f6kG2CwuqB32p9wSzJgNEaGsraj4JkEoDo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=v0MP8Wy8nIyN2/LRb3EZ2znMQWFYVkCV4GJXif1rEo0IMrn7fjJnLJ+AHC7j62hsRV tXNco3PwcpctZcqBA8YznXPxzsFKkM4LrWcXSHQOU2fxzZlMvOedGFi5HXxk3I0LPjmW wA04FcNbJGks5rs2swmEPNEwk6xVETKCh+DP4= Received: by 10.205.82.199 with SMTP id ad7mr511721bkc.152.1305572937096; Mon, 16 May 2011 12:08:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.205.65.198 with HTTP; Mon, 16 May 2011 12:08:27 -0700 (PDT) In-Reply-To: References: From: Chris Rees Date: Mon, 16 May 2011 20:08:27 +0100 Message-ID: To: ports@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: portmgr@freebsd.org Subject: Re: Propose new macro: INSTALL_CONF X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: utisoft@gmail.com List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2011 19:08:59 -0000 On 15 May 2011 21:56, Chris Rees wrote: > On 14 May 2011 18:32, Chris Rees wrote: >> On 14 May 2011 16:39, Chris Rees wrote: >>> Hi all, >>> >>> I'm getting frustrated with editing config files of ports in vi, and >>> being told it's read-only. >>> >>> This stops me using ZZ to quit, which makes me sad. >>> >>> It's also inconsistent with src/etc/Makefile which uses for example: >>> >>> .if ${MK_OPENSSH} !=3D "no" >>> =A0 =A0 =A0 =A0cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 6= 44 \ >>> =A0 =A0 =A0 =A0 =A0 =A0${SSH} ${DESTDIR}/etc/ssh >>> .endif >>> >>> The problem stems from installing .sample files as DATA, and then using >>> cp -p preserving the -w bits --> 444 makes perfect sense for a .sample = file, >>> but not at all for a config file. >>> >>> I have two options proposed. >>> >>> For both introduce CONFMODE into src/share/mk/bsd.own.mk, patch for >>> which is at [1]. >>> >>> Option 1: Rewrite the Porter's Handbook section on config files to use >>> a macro involving CONFMODE instead of cp -p, which gets complicated >>> when using with @exec in pkg-plist >>> >>> Option 2: Create an INSTALL_CONF macro, which handles the .conf.sample >>> -> .conf automagically and sticks the right lines into TMPPLIST. >>> >>> I'm swinging towards Option 2, but I haven't written the code for that >>> yet in case someone shoots me down :P >>> >>> Any concerns about inconsistencies between the INSTALL_* macros could >>> be addressed by calling it something different; I'm open to >>> suggestions! >>> >>> We'd also need to deal with the MFC and subsequent updates of bsd.own.m= k... >>> >>> Chris >>> >>> [1] http://www.bayofrum.net/~crees/patches/bsd-own-mk-confmode.patch >> >> A third option has occurred to me: >> >> Create a new variable USE_CONF_FILES to work in a similar vein to USE_RC= _SUBR... >> > > Right, I've fleshed this out with some real code. > > New variables: CONF_FILES and CONF_DIRS. > > CONF_FILES is like *_DEPENDS as a colon-separated field: > > CONF_FILES=3D =A0 absolute_path_to_source_file:prefix_relative_path_to_ta= rget_file > > CONF_DIRS=3D =A0 =A0dirs to add with @dirrmtry behaviour, in correct orde= r. > > Of course, CONF_FILES clashes with some other ports, so before > importing this we'd need to shift those aside / choose a different > name for this variable. > > > Patch to bsd.port.mk at [1], and a sample patch to net/opentracker [2] > with syntax. > > Try it out with ${FAVOURITE_PORT}! > > I also promise to document it (if approved) in the Porter's Handbook, > code it into portlint and maintain the code as well as take flak from > porters! > > Feedback very welcome. > > Chris > > [1] http://www.bayofrum.net/~crees/patches/bsd-port-mk-conf-files.patch > > [2] http://www.bayofrum.net/~crees/patches/opentracker_conf_example.patch Having spoken to bapt@ on IRC, I've added an ability to glob: CONF_FILES=3D ${WRKSRC}/conf_dir/*.conf:etc/${PORTNAME}/ If you're leaving off the destination filename (obviously necessary when globbing), leave a trailing slash on the destination dir and the corresponding filename will be put in for you. I've also changed .sample to .pkgconf to be more consistent with pkgng. New patch at [1]. I'm sorry if the code is a bit distasteful, if anyone wants to improve it they're welcome! Chris [1] http://www.bayofrum.net/~crees/patches/bsd-port-mk-conf-files-globbing.= patch