From owner-freebsd-ports@FreeBSD.ORG Tue Oct 30 20:29:06 2007 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 529ED16A46B for ; Tue, 30 Oct 2007 20:29:06 +0000 (UTC) (envelope-from rnsanchez@wait4.org) Received: from sumo.dreamhost.com (sumo.dreamhost.com [66.33.216.29]) by mx1.freebsd.org (Postfix) with ESMTP id 3F8D313C491 for ; Tue, 30 Oct 2007 20:29:06 +0000 (UTC) (envelope-from rnsanchez@wait4.org) Received: from spunkymail-a9.g.dreamhost.com (sd-green-bigip-207.dreamhost.com [208.97.132.207]) by sumo.dreamhost.com (Postfix) with ESMTP id 9A5D3179D5F for ; Tue, 30 Oct 2007 12:54:24 -0700 (PDT) Received: from sauron.lan.box (unknown [189.10.220.68]) by spunkymail-a9.g.dreamhost.com (Postfix) with ESMTP id 2131A21198 for ; Tue, 30 Oct 2007 12:54:11 -0700 (PDT) Date: Tue, 30 Oct 2007 17:53:48 -0200 From: Ricardo Nabinger Sanchez To: freebsd-ports@freebsd.org Message-Id: <20071030175348.47c6e060.rnsanchez@wait4.org> Organization: SYS_WAIT4 X-Mailer: Sylpheed 2.4.7 (GTK+ 2.10.14; i386-unknown-freebsd6.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: substitutions in pkg-plist X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2007 20:29:06 -0000 Hello, While working on an non-public port, I noticed that when I used macros like %%ETCDIR%%, %%EXAMPLESDIR%%, inside @exec, @unexec and @dirrm/@dirrmtry, the terminal output was as expected, but the commands would fail silently. For instance, I tried this (pkg-plist): @exec [ -d %%ETCDIR%%/socksarmor ] || mkdir -v %%ETCDIR%%/socksarmor @unexec if cmp -s %%EXAMPLESDIR%%/socksarmor.config %%ETCDIR%%/socksarmor.config; then rm -f %%ETCDIR%%/socksarmor.config; fi @unexec if cmp -s %%EXAMPLESDIR%%/socksarmor.xml %%ETCDIR%%/socksarmor.xml; then rm -f %%ETCDIR%%/socksarmor.xml; fi When executing pkg_add or pkg_delete (both with -v), the terminal output was fine, but things were not being executed. In this very case, I could confirm with ls that %%ETCDIR%%/socksarmor, for instance, was not being created. I copy-pasted the commands pkg_add printed, verbatim, and they worked as expected. After lots of googling and Mk browsing, I finally decided to partially hardcode things and use %D whenever possible, getting this: @exec [ -d %D/etc/socksarmor ] || mkdir -v %D/etc/socksarmor @unexec if cmp -s %D/share/examples/socksarmor/socksarmor.config %D/etc/socksarmor/socksarmor.config; then rm -f %D/etc/socksarmor/socksarmor.config; fi @unexec if cmp -s %D/share/examples/socksarmor/socksarmor.xml %D/etc/socksarmor/socksarmor.xml; then rm -f %D/etc/socksarmor/socksarmor.xml; fi This works, but it is not clear why %%whatever%% macros fail silently. I couldn't find useful docs, perhaps because google strip %s off my queries. Comments are appreciated. :) Regards. -- Ricardo Nabinger Sanchez rnsanchez@wait4.org Powered by FreeBSD "Left to themselves, things tend to go from bad to worse."