From edwin@mavetju.org  Wed Nov  9 09:46:03 2005
Return-Path: <edwin@mavetju.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8141116A420
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  9 Nov 2005 09:46:03 +0000 (GMT)
	(envelope-from edwin@mavetju.org)
Received: from mail3out.barnet.com.au (mail3out.barnet.com.au [202.83.176.17])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 07CB143D53
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  9 Nov 2005 09:46:02 +0000 (GMT)
	(envelope-from edwin@mavetju.org)
Received: by mail3out.barnet.com.au (Postfix, from userid 27)
	id 1A518877CCA; Wed,  9 Nov 2005 20:46:01 +1100 (EST)
Received: from mail3-auth.barnet.com.au (mail3.barnet.com.au [202.83.176.16])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "*.barnet.com.au", Issuer "BarNet Root Certificate Authority" (verified OK))
	by mail3.barnet.com.au (Postfix) with ESMTP id E48D4877CBD
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  9 Nov 2005 20:46:00 +1100 (EST)
Received: from k7.mavetju (edwin-3.int.barnet.com.au [10.10.12.2])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "edwin.adsl.barnet.com.au", Issuer "BarNet Root Certificate Authority" (not verified))
	by mail3-auth.barnet.com.au (Postfix) with ESMTP id 67C25877CAA
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  9 Nov 2005 20:46:00 +1100 (EST)
Received: by k7.mavetju (Postfix, from userid 1001)
	id 137066146; Wed,  9 Nov 2005 20:45:59 +1100 (EST)
Message-Id: <20051109094559.137066146@k7.mavetju>
Date: Wed,  9 Nov 2005 20:45:59 +1100 (EST)
From: Edwin Groothuis <edwin@mavetju.org>
Reply-To: Edwin Groothuis <edwin@mavetju.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] bsd.port.mk - implement @dirrmtry
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         88711
>Category:       ports
>Synopsis:       [patch] bsd.port.mk - implement @dirrmtry
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    edwin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 09 09:50:16 GMT 2005
>Closed-Date:    Sun Jan 22 21:51:14 GMT 2006
>Last-Modified:  Sun Jan 22 21:51:14 GMT 2006
>Originator:     Edwin Groothuis
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #8: Wed Dec 15 16:58:01 EST 2004 edwin@k7.mavetju:/usr/src-5.2.1/sys/i386/compile/k7 i386


>Description:

One of the things I can't cope is that the syntax of the pkg-plist
doesn't allow for a @dirrm which is allowed to fail. At this moment
the work-around is a "@unexec rmdir %D/foo 2>/dev/null || true",
which is hardly elegant nor a syntax which is worth being proud of
(but it works...)

Earlier suggestions with regarding to this complaint is that it
requires a set of tools to be rewritten to support it (pkg_delete
for example, which is in the base system and thus hard to upgrade).

My proposal is add the syntax already to the pkg-plist files, but
to convert it silently in bsd.port.mk to the old way. This way the
new syntax can be added the pkg-plist files, the new syntax can be
rolled out in the toolset when 7-CURRENT, 6.2-RELEASE, 5.6-RELEASE
and 4.13 (or when 4.x becomes unsupported) have been released and
then this patch can be undone in the bsd.port.mk file.

>How-To-Repeat:

    [~/cvs/ports/sysutils/newportsversioncheck] edwin@k7>tail -2 pkg-plist 
    @dirrm newportsversioncheck/etc
    @dirrmtry newportsversioncheck

    [~/cvs/ports/sysutils/newportsversioncheck] edwin@k7>make generate-plist

    [~/cvs/ports/sysutils/newportsversioncheck] edwin@k7>tail -2 work/.PLIST.mktmp 
    @dirrm newportsversioncheck/etc
    @unexec rmdir %D/newportsversioncheck 2>/dev/null || true

>Fix:

--- bsd.port.mk.orig	Wed Nov  9 20:20:23 2005
+++ bsd.port.mk	Wed Nov  9 20:30:59 2005
@@ -4856,7 +4856,10 @@
 	done
 .endfor
 	@if [ -f ${PLIST} ]; then \
-		${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} >> ${TMPPLIST}; \
+		${SED} \
+			${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+			-e 's!^@dirrmtry \(.*\)!@unexec rmdir %D/\1 2>/dev/null || true!' \
+			${PLIST} >> ${TMPPLIST}; \
 	fi
 .for dir in ${PLIST_DIRS}
 	@${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} | ${SED} -e 's,^,@dirrm ,' >> ${TMPPLIST}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Nov 9 10:52:06 GMT 2005 
Responsible-Changed-Why:  
Over to maintainers 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88711 
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Mon Dec 19 04:05:17 UTC 2005 
State-Changed-Why:  
A patch based on this is being testing on the cluster. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88711 
State-Changed-From-To: analyzed->closed 
State-Changed-By: linimon 
State-Changed-When: Sat Jan 21 19:54:49 UTC 2006 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88711 
State-Changed-From-To: closed->open 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
State-Changed-Why:  
over to myself for documentation and implementation 


Responsible-Changed-From-To: portmgr->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
Responsible-Changed-Why:  
over to myself for documentation and implementation 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87234 
State-Changed-From-To: closed->open 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
State-Changed-Why:  
over to myself for documentation and implementation 


Responsible-Changed-From-To: portmgr->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
Responsible-Changed-Why:  
Over to myself for documentation and implementation 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87318 
State-Changed-From-To: closed->open 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
State-Changed-Why:  
Over to myself for documentation and implementation 


Responsible-Changed-From-To: portmgr->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
Responsible-Changed-Why:  
Over to myself for documentation and implementation 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87605 
State-Changed-From-To: closed->open 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
State-Changed-Why:  
Over to myself for documentation and implementation 


Responsible-Changed-From-To: portmgr->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jan 21 21:48:34 UTC 2006 
Responsible-Changed-Why:  
Over to myself for documentation and implementation 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88711 
State-Changed-From-To: open->closed 
State-Changed-By: edwin 
State-Changed-When: Sun Jan 22 21:51:03 UTC 2006 
State-Changed-Why:  
Documentaed and executed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88711 
>Unformatted:
