Bug in ports system's DISTFILES handling?

Frank Laszlo laszlof at tvog.net
Mon Jan 17 11:52:03 PST 2005

This is quite possibly a bug. I took a lot at bsd.port.mk, and DISTFILES 
is supposed to default to
${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX} Which is does, until you 
"append" something else to it, exactly what you are trying to do. Other 
ports I'm looking at simply define the DISTFILES below the MASTER_SITE. 
This is going to cause a warning in portlint, but hey.. what can ya do. 
I'm going to investigate further. Hope this was helpful.

Frank Laszlo
System Administrator
The VonOstin Group
Email:  laszlof at tvog.net
WWW:    http://www.vonostingroup.com
Mobile: 248-863-7584

Conrad J. Sabatier wrote:

>As the (relatively new) maintainer of games/gnuchess, I recently
>encountered a peculiar problem re: the handling of DISTFILES=
>declarations (actually DISTFILES+= declarations, to be more precise),
>which I think may have exposed an actual bug in the ports build system.
>Basically, this port has both a standard source distfile
>"gnuchess-5.0.7.tar.gz", i.e., ${PORTNAME}${PORTVERSION}${EXTRACT_SUFX},
>as well as an optional file "book_1.01.pgn.gz", which is used to
>creating the opening book for gnuchess, based on the setting of the
>Makefile's OPENING_BOOK option.  This latter file is handled via a
>script, as it must be renamed to book.dat after extraction, before being
>submitted to gnuchess to generate its opening book file, hence the use
>of EXTRACT_ONLY= within the conditional block.
>Here's the current CVS version of the Makefile:
># New ports collection makefile for:	Gnu Chess
># Date created:		04 July 1996
># Whom:			markm
># $FreeBSD: ports/games/gnuchess/Makefile,v 1.20 2004/12/28 23:19:42
>edwin Exp $#
>PORTNAME=	gnuchess
>MAINTAINER=	conrads at cox.net
>COMMENT=	"Classic" Gnu Chess
>PLIST_FILES=	bin/gnuchess \
>		bin/gnuchessx
>.if !defined(NOPORTDOCS)
>PORTDOCS=	ChangeLog \
>		NEWS \
>OPTIONS=    OPENING_BOOK "Install opening book (24 MB download)" on
>.include <bsd.port.pre.mk>
>.if defined(WITH_OPENING_BOOK)
>DISTFILES+=	book_1.01.pgn.gz
>PLIST_FILES+=	%%DATADIR%%/book.dat
>CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
>		 s|-pthread ||g' ${WRKSRC}/configure
>.if defined(WITH_OPENING_BOOK)
>	@${SH} ${SCRIPTDIR}/create_opening_book.sh ${DISTDIR} ${WRKSRC}
>	${LN} -f ${PREFIX}/bin/gnuchess ${PREFIX}/bin/gnuchessx
>.if defined(WITH_OPENING_BOOK)
>	@${ECHO_CMD} Installing opening book
>	${MKDIR} ${DATADIR} && \
>	${CP} ${WRKSRC}/src/book.dat ${DATADIR}
>.if !defined(NOPORTDOCS)
>	@${ECHO_CMD} Installing documentation
>	${MKDIR} ${DOCSDIR} && \
>	${CP} ${WRKSRC}/NEWS ${DOCSDIR} && \
>	${CP} ${WRKSRC}/doc/* ${DOCSDIR}
>.include <bsd.port.post.mk>
>This all appears to be fine, and portlint accepts it without complaint,
>yet when the fetch target is run, the source package, i.e., 
>gnuchess-5.0.7.tar.gz, is not retrieved, regardless of the setting of
>the OPENING_BOOK option, whereas the book file is handled properly.
>Running 'portlint-v' on the port reveals that the conditionally executed
>"DISTFILES+=	book_1.01.pgn.gz" line is, in fact, appending to a
>previously null variable, whereas one would expect that DISTFILES would
>have already been set equal to DISTNAME automatically.
>In order to please portlint, my first attempt at remedying the problem
>was to add an explicit DISTNAME= line to the first block of
>declarations, but this still didn't work, producing exactly the same
>It was only by adding an explicit
>that the problem went away, although portlint now complains about using
>DISTFILES= for only a single file, apparently not taking into
>consideration at all the later, optional appending of the opening book
>Incidentally, portlint also complains that the EXTRACT_ONLY= line should
>appear earlier, but I have to agree with Edwin Groothuis (who made a few
>small mods to the Makefile after my original submission) that this line
>belongs where it is now, within the conditional block.
>Anyway, does this look like a genuine bug to anyone?  It sure does to
>me.  You'll note that the Makefile also uses PLIST_DIRS+= and
>PLIST_FILES+= declarations, but these behave exactly as one would
>expect, whereas DISTFILES+= seems to be badly broken.  Shouldn't
>DISTFILES be automatically set equal to DISTNAME early on, prior to any
>other declarations which may alter or override it?
>Thanks for taking the time to read this.

More information about the freebsd-ports mailing list