ports/70018: `make readmes` is gratuitously slow

Colin Percival cperciva at FreeBSD.org
Thu Aug 5 06:20:25 UTC 2004


>Number:         70018
>Category:       ports
>Synopsis:       `make readmes` is gratuitously slow
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 05 06:20:24 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Colin Percival
>Release:        FreeBSD 5.2.1-SECURITY i386
>Organization:
>Environment:
System: FreeBSD hexahedron.daemonology.net 5.2.1-SECURITY FreeBSD 5.2.1-SECURITY #0: Wed May 26 04:19:54 GMT 2004 root at builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
>Description:
`make readmes` recursively runs `make readme` in every port directory.  
This involves parsing around 5000 lines of Makefile code several times
per port.
Piping INDEX through a perl script is much faster.
>How-To-Repeat:
>Fix:

This patch adds a perl script "Tools/make_readmes", and modifies
bsd.port.subdir.mk to avoid recursing into individual port directories;
instead, it runs the perl script at the top level, after the category
README.html files have been created.

This could be improved further by creating the category README.html
files via perl script, but this would be slightly more complicated due
to the category descriptions not being pre-indexed.

--- make_readmes.diff begins here ---
Index: Mk/bsd.port.subdir.mk
===================================================================
RCS file: /usr/cvsroot/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.55
diff -u -r1.55 bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk	14 Jul 2004 08:18:16 -0000	1.55
+++ Mk/bsd.port.subdir.mk	5 Aug 2004 06:03:35 -0000
@@ -236,7 +236,13 @@
 .endif
 
 .if !target(readmes)
+.if defined(PORTSTOP)
 readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
+	@${ECHO_MSG} "===>   Creating README.html for all ports"
+	@perl ${.CURDIR}/Tools/make_readmes < ${.CURDIR}/${INDEXFILE}
+.else
+readmes: readme
+.endif
 .endif
 
 .if !target(readme)
--- /dev/null	Wed Aug  4 23:00:00 2004
+++ Tools/make_readmes	Wed Aug  4 21:45:05 2004
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+$README=`cat Templates/README.port`;
+
+while(<>) {
+	split '\|';
+
+	$PKG=$_[0];
+	$PORT=$_[1];
+	$COMMENT=$_[3];
+	$DESCR=$_[4];
+	$EMAIL=$_[5];
+	$BUILD_DEPENDS=$_[7];
+	$RUN_DEPENDS=$_[8];
+	$WEBSITE=$_[9];
+
+	$DESCR=~s|^\Q$PORT/\E||;
+	$PORT=~s|`pwd`||;
+
+	if($WEBSITE) {
+		$WEBSITE=" and/or visit the <a href=\"$WEBSITE\">web site</a> for futher informations"
+	};
+	if($BUILD_DEPENDS) {
+		$BUILD_DEPENDS="This port requires package(s) \"$BUILD_DEPENDS\" to build."
+	};
+	if($RUN_DEPENDS) {
+		$RUN_DEPENDS="This port requires package(s) \"$RUN_DEPENDS\" to run."
+	};
+
+	$TOP=$PORT;
+	$TOP=~s|[^/]+|..|g;
+
+	$tmp=$README;
+	$tmp=~s|%%PKG%%|$PKG|g;
+	$tmp=~s|%%PORT%%|$PORT|g;
+	$tmp=~s|%%COMMENT%%|$COMMENT|g;
+	$tmp=~s|%%DESCR%%|$DESCR|g;
+	$tmp=~s|%%EMAIL%%|$EMAIL|g;
+	$tmp=~s|%%WEBSITE%%|$WEBSITE|g;
+	$tmp=~s|%%BUILD_DEPENDS%%|$BUILD_DEPENDS|g;
+	$tmp=~s|%%RUN_DEPENDS%%|$RUN_DEPENDS|g;
+	$tmp=~s|%%TOP%%|$TOP|g;
+
+	open F,">$PORT/README.html";
+	print F $tmp;
+	close F
+}
--- make_readmes.diff ends here ---


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



More information about the freebsd-ports-bugs mailing list