ports/59070: [PATCH] bsd.port.mk: unexpected features of PORTDOCS

Oliver Eikemeier eikemeier at fillmore-labs.com
Sun Nov 9 02:50:23 UTC 2003


>Number:         59070
>Category:       ports
>Synopsis:       [PATCH] bsd.port.mk: unexpected features of PORTDOCS
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 08 18:50:21 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

Two unpleasant facts about the new PORTDOCS macro:

- it will add `@cwd /usr/local' to packing lists that didn't contain a `@cwd'.
  Normally, this does no harm, but results in problems if someone does
  `pkg_add -p /my/prefix pkg-name'
  This usage is not really supported, so this no real problem, but it is not pretty.

- Every package that defines PORTDOCS gets
  `@unexec rmdir ${DOCSDIR} 2>/dev/null || true'
  added to the packing list. The documetation states to define PORTDOCS only if
  documentation is installed, but for example port net/ngrep does:

  PORTDOCS=	BUGS CHANGES README README.pcre USAGE

  post-install:
  .if !defined(NOPORTDOCS)
  	@${MKDIR} ${DOCSDIR}
  .for file in ${PORTDOCS}
  	${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
  .endfor
  .endif

  which looks like a legitimate usage. So I have to check if the directory exists before
  adding the rmdir.

Both bugs cause no real harm, but its better to fix them nevertheless.

>How-To-Repeat:
>Fix:

--- bsd.port.mk.patch begins here ---
--- bsd.port.mk.orig	Sun Nov  9 01:51:03 2003
+++ bsd.port.mk	Sun Nov  9 02:25:24 2003
@@ -4504,14 +4504,17 @@
 .if !target(add-plist-docs)
 add-plist-docs:
 .if defined(PORTDOCS)
-	@if [ "`${SED} -En -e '/^@cw?d[ 	]*/s,,,p' ${TMPPLIST} | tail -n 1`" != "${PREFIX}" ]; then \
+	@if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \
+		[ "`${SED} -En -e '/^@cw?d[ 	]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
 		${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
 	fi
 	@${FIND} -P ${PORTDOCS:S/^/${DOCSDIR}\//} -not -type d 2>/dev/null | \
 		${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST}
 	@${FIND} -P -d ${PORTDOCS:S/^/${DOCSDIR}\//} -type d 2>/dev/null | \
 		${SED} -ne 's,^${PREFIX}/, at dirrm ,p' >> ${TMPPLIST}
-	@${ECHO_CMD} "@unexec rmdir %D/${DOCSDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}
+	@if [ -d "${DOCSDIR}" ]; then \
+		${ECHO_CMD} "@unexec rmdir %D/${DOCSDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}; \
+	fi
 .else
 	@${DO_NADA}
 .endif
--- bsd.port.mk.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list