Sat Oct 3 13:17:57 2015 UTC ()
Add a list of options to generated README.html files. Patch from
Daniel Loffgren on tech-pkg, slightly modified by me to use dl tags.


(bsiegert)
diff -r1.35 -r1.36 pkgsrc/mk/scripts/genreadme.awk
diff -r0 -r1.1 pkgsrc/mk/scripts/htmloptions.awk
diff -r1.9 -r1.10 pkgsrc/mk/scripts/mkdatabase
diff -r1.27 -r1.28 pkgsrc/mk/scripts/mkreadme
diff -r1.26 -r1.27 pkgsrc/templates/README.pkg

cvs diff -r1.35 -r1.36 pkgsrc/mk/scripts/genreadme.awk (expand / switch to unified diff)

--- pkgsrc/mk/scripts/genreadme.awk 2013/05/09 23:37:27 1.35
+++ pkgsrc/mk/scripts/genreadme.awk 2015/10/03 13:17:57 1.36
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1#!/usr/bin/awk -f 1#!/usr/bin/awk -f
2# $NetBSD: genreadme.awk,v 1.35 2013/05/09 23:37:27 riastradh Exp $ 2# $NetBSD: genreadme.awk,v 1.36 2015/10/03 13:17:57 bsiegert Exp $
3# 3#
4# Copyright (c) 2002, 2003, 2005, 2006 The NetBSD Foundation, Inc. 4# Copyright (c) 2002, 2003, 2005, 2006, 2015 The NetBSD Foundation, Inc.
5# All rights reserved. 5# All rights reserved.
6# 6#
7# This code is derived from software contributed to The NetBSD Foundation 7# This code is derived from software contributed to The NetBSD Foundation
8# by Dan McMahill. 8# by Dan McMahill.
9# 9#
10# Redistribution and use in source and binary forms, with or without 10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions 11# modification, are permitted provided that the following conditions
12# are met: 12# are met:
13# 1. Redistributions of source code must retain the above copyright 13# 1. Redistributions of source code must retain the above copyright
14# notice, this list of conditions and the following disclaimer. 14# notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright 15# 2. Redistributions in binary form must reproduce the above copyright
16# notice, this list of conditions and the following disclaimer in the 16# notice, this list of conditions and the following disclaimer in the
17# documentation and/or other materials provided with the distribution. 17# documentation and/or other materials provided with the distribution.
@@ -155,26 +155,35 @@ BEGIN { @@ -155,26 +155,35 @@ BEGIN {
155 htmlname = $3; 155 htmlname = $3;
156 for (i = 4; i <= NF; i++){ 156 for (i = 4; i <= NF; i++){
157 htmlname = htmlname " " $i; 157 htmlname = htmlname " " $i;
158 } 158 }
159 # If we are using a name other than README.html, change it 159 # If we are using a name other than README.html, change it
160 # here. This avoids having to process a huge line later which 160 # here. This avoids having to process a huge line later which
161 # makes lesser awks puke. 161 # makes lesser awks puke.
162 gsub(/README.html/, readme_name, htmlname); 162 gsub(/README.html/, readme_name, htmlname);
163 dir2htmlname[dir] = htmlname; 163 dir2htmlname[dir] = htmlname;
164 if (debug) printf("added dir2htmlname[%s]=%s\n", dir, htmlname); 164 if (debug) printf("added dir2htmlname[%s]=%s\n", dir, htmlname);
165 next; 165 next;
166} 166}
167 167
 168/^htmloptions / {
 169 htmloptions = $3;
 170 for (i = 4; i <= NF; i++){
 171 htmloptions = htmloptions " " $i;
 172 }
 173 options[$2] = htmloptions;
 174 next;
 175}
 176
168/^index / { 177/^index / {
169# 178#
170# read lines like: 179# read lines like:
171#index /usr/pkgsrc/math/scilab scilab-2.6nb3 180#index /usr/pkgsrc/math/scilab scilab-2.6nb3
172# and store the directory name in a associative array where the index 181# and store the directory name in a associative array where the index
173# is the package name and in a associative array that lets us lookup 182# is the package name and in a associative array that lets us lookup
174# name from directory. We use fuldir2pkgdir to get "math/scilab" 183# name from directory. We use fuldir2pkgdir to get "math/scilab"
175# and drop the /usr/pkgsrc part. 184# and drop the /usr/pkgsrc part.
176# 185#
177# pkgname2dir[$3] = fulldir2pkgdir($2); 186# pkgname2dir[$3] = fulldir2pkgdir($2);
178# pkgdir2name[fulldir2pkgdir($2)] = $3; 187# pkgdir2name[fulldir2pkgdir($2)] = $3;
179 pkgname2dir[$3] = $2; 188 pkgname2dir[$3] = $2;
180 pkgdir2name[$2] = $3; 189 pkgdir2name[$2] = $3;
@@ -385,26 +394,27 @@ END { @@ -385,26 +394,27 @@ END {
385 } else { 394 } else {
386 gsub(/%%HOMEPAGE%%/, 395 gsub(/%%HOMEPAGE%%/,
387 "<p>This package has a home page at <a HREF=\"" homepage[toppkg] "\">" homepage[toppkg] "</a>.</p>"); 396 "<p>This package has a home page at <a HREF=\"" homepage[toppkg] "\">" homepage[toppkg] "</a>.</p>");
388 } 397 }
389 if (license[toppkg] == "") { 398 if (license[toppkg] == "") {
390 gsub(/%%LICENSE%%/, ""); 399 gsub(/%%LICENSE%%/, "");
391 } else { 400 } else {
392 gsub(/%%LICENSE%%/, 401 gsub(/%%LICENSE%%/,
393 "<p>Please note that this package has a " license[toppkg] " license.</p>"); 402 "<p>Please note that this package has a " license[toppkg] " license.</p>");
394 } 403 }
395 gsub(/%%VULNERABILITIES%%/, ""vul""); 404 gsub(/%%VULNERABILITIES%%/, ""vul"");
396 gsub(/%%VULDATE%%/, ""vuldate""); 405 gsub(/%%VULDATE%%/, ""vuldate"");
397 gsub(/%%RUN_DEPENDS%%/, ""rundeps""); 406 gsub(/%%RUN_DEPENDS%%/, ""rundeps"");
 407 gsub(/%%OPTIONS%%/, ""options[toppkg]"");
398 408
399 line = $0; 409 line = $0;
400 410
401 if( line ~/%%BIN_PKGS%%/ ) { 411 if( line ~/%%BIN_PKGS%%/ ) {
402 gsub(/%%BIN_PKGS%%/, "", line); 412 gsub(/%%BIN_PKGS%%/, "", line);
403 while((getline < binpkgs_file) > 0) { 413 while((getline < binpkgs_file) > 0) {
404 print >> readme; 414 print >> readme;
405 } 415 }
406 close( binpkgs_file ); 416 close( binpkgs_file );
407 } 417 }
408 418
409 # XXX Need to handle BUILD_DEPENDS/TOOL_DEPENDS 419 # XXX Need to handle BUILD_DEPENDS/TOOL_DEPENDS
410 # split. 420 # split.

File Added: pkgsrc/mk/scripts/htmloptions.awk
#!/usr/bin/awk -f
# $NetBSD: htmloptions.awk,v 1.1 2015/10/03 13:17:57 bsiegert Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#        This product includes software developed by the NetBSD
#        Foundation, Inc. and its contributors.
# 4. Neither the name of The NetBSD Foundation nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

BEGIN {
	FS = "\t";
}

/^\t/ {
	o++;
	printf "<dt>%s</dt><dd>%s</dd>", $2, $3;
}

/^These options are/ {
	finalize();
	exit;
}

END {
	finalize();
}

function finalize() {
	if(o == 0) {
		printf "<dt><em>(none)</em></dt>";
	}
}

cvs diff -r1.9 -r1.10 pkgsrc/mk/scripts/mkdatabase (expand / switch to unified diff)

--- pkgsrc/mk/scripts/mkdatabase 2005/11/18 11:07:27 1.9
+++ pkgsrc/mk/scripts/mkdatabase 2015/10/03 13:17:57 1.10
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2# $NetBSD: mkdatabase,v 1.9 2005/11/18 11:07:27 rillig Exp $ 2# $NetBSD: mkdatabase,v 1.10 2015/10/03 13:17:57 bsiegert Exp $
3# 3#
4# Script for generating a database with complete dependency information 4# Script for generating a database with complete dependency information
5# for a particular package 5# for a particular package
6# 6#
7# Copyright (c) 2003 The NetBSD Foundation, Inc. 7# Copyright (c) 2003 The NetBSD Foundation, Inc.
8# All rights reserved. 8# All rights reserved.
9# 9#
10# This code is derived from software contributed to The NetBSD Foundation 10# This code is derived from software contributed to The NetBSD Foundation
11# by Dan McMahill. 11# by Dan McMahill.
12# 12#
13# Redistribution and use in source and binary forms, with or without 13# Redistribution and use in source and binary forms, with or without
14# modification, are permitted provided that the following conditions 14# modification, are permitted provided that the following conditions
15# are met: 15# are met:
@@ -150,51 +150,53 @@ case ${DATABASE} in @@ -150,51 +150,53 @@ case ${DATABASE} in
150 # we already have the absolute path to the database file 150 # we already have the absolute path to the database file
151 # so do nothing 151 # so do nothing
152 ;; 152 ;;
153 153
154 *) 154 *)
155 # FIXME: wouldn't it be better to fail in this case? 155 # FIXME: wouldn't it be better to fail in this case?
156 156
157 # make sure we have the full path to the database file 157 # make sure we have the full path to the database file
158 DATABASE=`pwd`/${DATABASE} 158 DATABASE=`pwd`/${DATABASE}
159 ;; 159 ;;
160esac 160esac
161 161
162 162
 163here=`pwd`
 164tmp1=`dirname "$here"`
 165pkgcat=`basename "$tmp1"`
 166pkg=`basename "$here"`
 167pkgpath=$pkgcat/$pkg
163if [ $append_flag = yes ]; then 168if [ $append_flag = yes ]; then
164 echo "$prompt Appending to database in ${DATABASE}" 169 echo "$prompt Appending to database in ${DATABASE}"
165 if [ ! -f "${DATABASE}" ]; then 170 if [ ! -f "${DATABASE}" ]; then
166 touch "${DATABASE}" 171 touch "${DATABASE}"
167 fi 172 fi
168 # make sure we haven't already been listed before 173 # make sure we haven't already been listed before
169 # appending ourselves. 174 # appending ourselves.
170 here=`pwd` 
171 tmp1=`dirname "$here"` 
172 pkgcat=`basename "$tmp1"` 
173 pkg=`basename "$here"` 
174 pkgpath=$pkgcat/$pkg 
175 case $debug_flag in 175 case $debug_flag in
176 yes) echo "Looking for $pkgpath before appending";; 176 yes) echo "Looking for $pkgpath before appending";;
177 esac 177 esac
178 # FIXME: $pkgpath may contain special regex characters. 178 # FIXME: $pkgpath may contain special regex characters.
179 if grep "^index $pkgpath " "${DATABASE}" >/dev/null 2>&1 ; then 179 if grep "^index $pkgpath " "${DATABASE}" >/dev/null 2>&1 ; then
180 echo "$prompt $pkgpath has already been depended. Skipping..." 180 echo "$prompt $pkgpath has already been depended. Skipping..."
181 exit 0 181 exit 0
182 else 182 else
183 ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1 183 ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1
184 fi 184 fi
185else 185else
186 echo "$prompt Creating new database in ${DATABASE}" 186 echo "$prompt Creating new database in ${DATABASE}"
187 ${BMAKE} print-summary-data > "${DATABASE}" || exit 1 187 o=`${BMAKE} show-options | ${AWK} -f ../../mk/scripts/htmloptions.awk`
 188 echo "htmloptions ${pkgpath} $o" > ${DATABASE}
 189 ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1
188fi 190fi
189here=`pwd` 191here=`pwd`
190echo "$prompt Depending in $here (pass #1)" 192echo "$prompt Depending in $here (pass #1)"
191dirs=`${AWK} -f ../../mk/scripts/chkdatabase.awk debug=${debug_flag} "${DATABASE}"` 193dirs=`${AWK} -f ../../mk/scripts/chkdatabase.awk debug=${debug_flag} "${DATABASE}"`
192pass=2 194pass=2
193while [ ! -z "$dirs" -a $pass -lt "${MAX_PASS}" ]; do 195while [ ! -z "$dirs" -a $pass -lt "${MAX_PASS}" ]; do
194 for d in $dirs ; do 196 for d in $dirs ; do
195 echo "$prompt Depending in ../../$d (pass #$pass)" ;\ 197 echo "$prompt Depending in ../../$d (pass #$pass)" ;\
196 cd "../../$d" && ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1 198 cd "../../$d" && ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1
197 cd "$here" 199 cd "$here"
198 done 200 done
199 dirs=`${AWK} -f ../../mk/scripts/chkdatabase.awk debug=${debug_flag} ${DATABASE}` 201 dirs=`${AWK} -f ../../mk/scripts/chkdatabase.awk debug=${debug_flag} ${DATABASE}`
200 pass=`${EXPR} $pass + 1` 202 pass=`${EXPR} $pass + 1`

cvs diff -r1.27 -r1.28 pkgsrc/mk/scripts/mkreadme (expand / switch to unified diff)

--- pkgsrc/mk/scripts/mkreadme 2015/06/13 12:09:32 1.27
+++ pkgsrc/mk/scripts/mkreadme 2015/10/03 13:17:57 1.28
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#!/bin/sh 1#!/bin/sh
2# $NetBSD: mkreadme,v 1.27 2015/06/13 12:09:32 spz Exp $ 2# $NetBSD: mkreadme,v 1.28 2015/10/03 13:17:57 bsiegert Exp $
3# 3#
4# Script for README.html generation 4# Script for README.html generation
5# 5#
6# Copyright (c) 2002, 2005 The NetBSD Foundation, Inc. 6# Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
7# All rights reserved. 7# All rights reserved.
8# 8#
9# This code is derived from software contributed to The NetBSD Foundation 9# This code is derived from software contributed to The NetBSD Foundation
10# by Dan McMahill. 10# by Dan McMahill.
11# 11#
12# Redistribution and use in source and binary forms, with or without 12# Redistribution and use in source and binary forms, with or without
13# modification, are permitted provided that the following conditions 13# modification, are permitted provided that the following conditions
14# are met: 14# are met:
15# 1. Redistributions of source code must retain the above copyright 15# 1. Redistributions of source code must retain the above copyright
@@ -371,36 +371,38 @@ if [ "x$restart" = "xno" ] ; then @@ -371,36 +371,38 @@ if [ "x$restart" = "xno" ] ; then
371 echo "Extracting data for category ${c}" 371 echo "Extracting data for category ${c}"
372 fi 372 fi
373 cd ${PKGSRCDIR}/${c} 373 cd ${PKGSRCDIR}/${c}
374 list=`${BMAKE} show-subdir-var VARNAME=SUBDIR` 374 list=`${BMAKE} show-subdir-var VARNAME=SUBDIR`
375 for pkgdir in $list ; do 375 for pkgdir in $list ; do
376 cd ${PKGSRCDIR}/${c} 376 cd ${PKGSRCDIR}/${c}
377 if [ ! -d $pkgdir ]; then 377 if [ ! -d $pkgdir ]; then
378 echo " " 378 echo " "
379 echo "WARNING: the package directory $pkgdir is listed in" > /dev/stderr 379 echo "WARNING: the package directory $pkgdir is listed in" > /dev/stderr
380 echo " ${PKGSRCDIR}/${c}/Makefile" > /dev/stderr 380 echo " ${PKGSRCDIR}/${c}/Makefile" > /dev/stderr
381 echo " but the directory does not exist. Please fix this!" > /dev/stderr 381 echo " but the directory does not exist. Please fix this!" > /dev/stderr
382 else 382 else
383 cd ${PKGSRCDIR}/${c}/${pkgdir} 383 cd ${PKGSRCDIR}/${c}/${pkgdir}
 384 o=`${BMAKE} show-options | ${AWK} -f ${PKGSRCDIR}/mk/scripts/htmloptions.awk`
384 l=`${BMAKE} print-summary-data` 385 l=`${BMAKE} print-summary-data`
385 if [ $? != 0 ]; then 386 if [ $? != 0 ]; then
386 echo "WARNING (printdepends): the package in ${c}/${pkgdir} had problem with" \ 387 echo "WARNING (printdepends): the package in ${c}/${pkgdir} had problem with" \
387 > /dev/stderr 388 > /dev/stderr
388 echo " ${BMAKE} print-summary-data" > /dev/stderr 389 echo " ${BMAKE} print-summary-data" > /dev/stderr
389 echo " database information for this package" > /dev/stderr 390 echo " database information for this package" > /dev/stderr
390 echo " will be dropped." > /dev/stderr 391 echo " will be dropped." > /dev/stderr
391 ${BMAKE} print-summary-data 2>&1 > /dev/stderr 392 ${BMAKE} print-summary-data 2>&1 > /dev/stderr
392 else 393 else
393 echo "$l" >> $DATABASEFILE 394 echo "$l" >> $DATABASEFILE
 395 echo "htmloptions ${c}/${pkgdir} $o" >> $DATABASEFILE
394 fi 396 fi
395 fi 397 fi
396 if [ "x$quiet" = "xno" ]; then 398 if [ "x$quiet" = "xno" ]; then
397 ${ECHO} -n "." 399 ${ECHO} -n "."
398 if [ `${EXPR} $npkg % 100 = 0` -eq 1 ]; then 400 if [ `${EXPR} $npkg % 100 = 0` -eq 1 ]; then
399 echo " " 401 echo " "
400 echo "$npkg" 402 echo "$npkg"
401 fi 403 fi
402 fi 404 fi
403 npkg=`${EXPR} $npkg + 1` 405 npkg=`${EXPR} $npkg + 1`
404 cd ${PKGSRCDIR} 406 cd ${PKGSRCDIR}
405 done 407 done
406 fi 408 fi

cvs diff -r1.26 -r1.27 pkgsrc/templates/README.pkg (expand / switch to unified diff)

--- pkgsrc/templates/README.pkg 2010/03/18 10:18:19 1.26
+++ pkgsrc/templates/README.pkg 2015/10/03 13:17:57 1.27
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2<!-- $NetBSD: README.pkg,v 1.26 2010/03/18 10:18:19 wiz Exp $ --> 2<!-- $NetBSD: README.pkg,v 1.27 2015/10/03 13:17:57 bsiegert Exp $ -->
3<html> 3<html>
4<head> 4<head>
5<title>The NetBSD Packages Collection: %%PORT%%</title> 5<title>The NetBSD Packages Collection: %%PORT%%</title>
6</head> 6</head>
7<body bgcolor="#ffffff"> 7<body bgcolor="#ffffff">
8 8
9<a href="http://www.mckusick.com/beastie/mainpage/copyright.html"> 9<a href="http://www.mckusick.com/beastie/mainpage/copyright.html">
10<img align="right" src="../../templates/pkg-daemon.gif" alt="Daemon Power" 10<img align="right" src="../../templates/pkg-daemon.gif" alt="Daemon Power"
11 width="147" height="121" border="0"> 11 width="147" height="121" border="0">
12</a> 12</a>
13<h1>The NetBSD Packages Collection: <i>%%PORT%%</i></h1> 13<h1>The NetBSD Packages Collection: <i>%%PORT%%</i></h1>
14 14
15<p>Brief description of the package:<br> 15<p>Brief description of the package:<br>
@@ -58,32 +58,39 @@ security advisories as being vulnerable. @@ -58,32 +58,39 @@ security advisories as being vulnerable.
58 58
59<p> 59<p>
60This package requires the following package(s) to build: 60This package requires the following package(s) to build:
61%%BUILD_DEPENDS%% 61%%BUILD_DEPENDS%%
62. 62.
63</p> 63</p>
64<p> 64<p>
65This package requires the following package(s) to run: 65This package requires the following package(s) to run:
66%%RUN_DEPENDS%% 66%%RUN_DEPENDS%%
67. 67.
68</p> 68</p>
69 69
70<p> 70<p>
 71This package supports the following build-time options:
 72</p>
 73<dl>
 74%%OPTIONS%%
 75</dl>
 76
 77<p>
71Select one of the links below to <FONT COLOR="red">download</FONT> the 78Select one of the links below to <FONT COLOR="red">download</FONT> the
72package in precompiled binary form for installation with pkg_add(1). 79package in precompiled binary form for installation with pkg_add(1).
73Available machine architectures and package versions: 80Available machine architectures and package versions:
74<TABLE> 81<table>
75%%BIN_PKGS%% 82%%BIN_PKGS%%
76</TABLE> 83</table>
77 84
78<p> 85<p>
79The NetBSD packages collection is designed to permit 86The NetBSD packages collection is designed to permit
80 easy <a href="../../README">installation from source</a> - 87 easy <a href="../../README">installation from source</a> -
81 particularly useful if the latest binary package is 88 particularly useful if the latest binary package is
82 not available for your chosen platform. 89 not available for your chosen platform.
83</p> 90</p>
84 91
85<hr noshade> 92<hr noshade>
86[ 93[
87<a href="../README.html"> Go up one level</a> 94<a href="../README.html"> Go up one level</a>
88| 95|
89<a href="../../README.html"> Go to top of packages tree</a> 96<a href="../../README.html"> Go to top of packages tree</a>