Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  9 Nov 2005 20:45:59 +1100 (EST)
From:      Edwin Groothuis <edwin@mavetju.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/88711: [patch] bsd.port.mk - implement @dirrmtry
Message-ID:  <20051109094559.137066146@k7.mavetju>
Resent-Message-ID: <200511090950.jA99oGaD008458@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         88711
>Category:       ports
>Synopsis:       [patch] bsd.port.mk - implement @dirrmtry
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 09 09:50:16 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051109094559.137066146>