Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  2 Dec 2003 14:05:21 -0800 (PST)
From:      Trevor Johnson <trevor@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/59909: patch to obviate many PLIST files
Message-ID:  <20031202220521.1742716A4CF@hub.freebsd.org>
Resent-Message-ID: <200312022210.hB2MACVa081974@freefall.freebsd.org>

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

>Number:         59909
>Category:       ports
>Synopsis:       patch to obviate many PLIST files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 02 14:10:12 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Trevor Johnson
>Release:        FreeBSD 5.2-BETA i386
>Organization:
just me
>Environment:
	bsd.port.mk 1.474 and recent ports collection
>Description:
This patch to bsd.port.mk is intended to reduce the need for PLIST
files.  These files account for much of the size of the ports
collection, in both inodes and bytes.  Today there are 9122 pkg-plist
files (including 8 that are empty) and the largest 5 occupy 2800 kB.
There are 881 which consist of a single line of the form
"bin/PORTNAME" so this patch provides a default which makes it
possible to simply remove those PLIST files.  It also provides two
makefile variables:  PLD, a list of directories for the packing
list; and PLF, files and symbolic links.  These variables can augment
or replace the PLIST file.  They make it easier to implement
conditional packing lists.

I have not made any special provision for packing lists which contain
@exec/@unexec scripts.  Those can be left as-is or used in conjuction
with the PLD and PLF variables.

As an example, these 8 lines which add 256 bytes to
ports/audio/aumix/Makefile can replace its 23-line, 658-byte PLIST
file:

-- begin example --
PLD=	share/aumix
PLF=	bin/aumix bin/mute bin/xaumix
.for ii in ansi aumix.xpm fadein.set fadeout.set vt100 xterm
PLF+=	share/aumix/${ii}
.endfor
.for ii in de el es fr gl ja nl pl pt_BR ru sv uk zh_CN
PLF+=	share/locale/${ii}/LC_MESSAGES/aumix.mo
.endfor
-- end example --

Here is the resulting work/.PLIST.mktmp:

-- begin .PLIST.mktmp --
bin/aumix
bin/mute
bin/xaumix
share/aumix/ansi
share/aumix/aumix.xpm
share/aumix/fadein.set
share/aumix/fadeout.set
share/aumix/vt100
share/aumix/xterm
share/locale/de/LC_MESSAGES/aumix.mo
share/locale/el/LC_MESSAGES/aumix.mo
share/locale/es/LC_MESSAGES/aumix.mo
share/locale/fr/LC_MESSAGES/aumix.mo
share/locale/gl/LC_MESSAGES/aumix.mo
share/locale/ja/LC_MESSAGES/aumix.mo
share/locale/nl/LC_MESSAGES/aumix.mo
share/locale/pl/LC_MESSAGES/aumix.mo
share/locale/pt_BR/LC_MESSAGES/aumix.mo
share/locale/ru/LC_MESSAGES/aumix.mo
share/locale/sv/LC_MESSAGES/aumix.mo
share/locale/uk/LC_MESSAGES/aumix.mo
share/locale/zh_CN/LC_MESSAGES/aumix.mo
man/man1/aumix.1.gz
man/man1/xaumix.1.gz
@unexec rm -f %D/man/cat1/aumix.1 %D/man/cat1/aumix.1.gz
@unexec rm -f %D/man/cat1/xaumix.1 %D/man/cat1/xaumix.1.gz
@dirrm share/aumix
@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi
-- end .PLIST.mktmp --

>How-To-Repeat:
	Extract ports tarball onto a hard disk.

>Fix:
also at http://people.freebsd.org/~trevor/ports/pld-plf.diff

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.474
diff -u -r1.474 bsd.port.mk
--- bsd.port.mk	24 Nov 2003 01:08:41 -0000	1.474
+++ bsd.port.mk	2 Dec 2003 20:26:21 -0000
@@ -747,6 +747,9 @@
 # MTREE_FILE	- The name of the mtree file (default: /etc/mtree/BSD.x11.dist
 #				  if USE_X_PREFIX is set, /etc/mtree/BSD.local.dist
 #				  otherwise.)
+# PLD		- directories to be added to packing list
+# PLF		- files and symbolic links to be added to packing list
+#				(defaults to bin/${PORTNAME} if ${PLIST} absent)
 # PLIST			- Name of the `packing list' file (default: ${PKGDIR}/pkg-plist).
 #				  Change this to ${WRKDIR}/PLIST or something if you
 #				  need to write to it.  (It is not a good idea for a port
@@ -1878,6 +1881,9 @@
 COMMENTFILE?=		${PKGDIR}/pkg-comment
 DESCR?=			${PKGDIR}/pkg-descr
 PLIST?=			${PKGDIR}/pkg-plist
+.if !exists(${PLIST})
+PLF?=	bin/${PORTNAME}
+.endif
 PKGINSTALL?=	${PKGDIR}/pkg-install
 PKGDEINSTALL?=	${PKGDIR}/pkg-deinstall
 PKGREQ?=		${PKGDIR}/pkg-req
@@ -4431,8 +4437,11 @@
 generate-plist:
 	@${ECHO_MSG} "===>   Generating temporary packing list"
 	@${MKDIR} `dirname ${TMPPLIST}`
-	@if [ ! -f ${PLIST} -o ! -f ${DESCR} ]; then ${ECHO_CMD} "** Missing package files for ${PKGNAME}."; exit 1; fi
+	@if [ ! -f ${DESCR} ]; then ${ECHO_CMD} "** Missing pkg-descr for ${PKGNAME}."; exit 1; fi
 	@>${TMPPLIST}
+	@for file in ${PLF}; do \
+		${ECHO_CMD} $${file} >> ${TMPPLIST}; \
+	done
 	@for man in ${__MANPAGES}; do \
 		${ECHO_CMD} $${man} >> ${TMPPLIST}; \
 	done
@@ -4468,7 +4477,12 @@
 .endif
 .endif
 .endfor
+.if exists(${PLIST})
 	@${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} >> ${TMPPLIST}
+.endif
+.for dir in ${PLD}
+	@${ECHO_CMD} ${dir} | ${SED} -e 's,^,@dirrm ,' >> ${TMPPLIST}
+.endfor
 .if !defined(NO_MTREE)
 	@${ECHO_CMD} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST}
 .endif
>Release-Note:
>Audit-Trail:
>Unformatted:



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