summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmcmahill <dmcmahill>2006-07-28 02:41:07 +0000
committerdmcmahill <dmcmahill>2006-07-28 02:41:07 +0000
commit4bb70e485ec754a58c6eaeff2b273c02ad9b26e8 (patch)
tree219e39357b9a80836df1809b19de0220ebc42c9d
parent2503f6f5feeb62716da824649ab752bd74c4af73 (diff)
downloadpkgsrc-4bb70e485ec754a58c6eaeff2b273c02ad9b26e8.tar.gz
Allow the binpkg-cache script to also generate pkg_summary.gz files
if requested. Suggested by Joerg Sonnenberger.
-rwxr-xr-xmk/scripts/binpkg-cache43
-rwxr-xr-xmk/scripts/genreadme.awk33
-rwxr-xr-xmk/scripts/mkreadme18
-rw-r--r--pkgtools/prereq-readme/Makefile3
4 files changed, 77 insertions, 20 deletions
diff --git a/mk/scripts/binpkg-cache b/mk/scripts/binpkg-cache
index 444fd63d358..4b10400b0d5 100755
--- a/mk/scripts/binpkg-cache
+++ b/mk/scripts/binpkg-cache
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: binpkg-cache,v 1.10 2006/06/21 14:13:27 dmcmahill Exp $
+# $NetBSD: binpkg-cache,v 1.11 2006/07/28 02:41:07 dmcmahill Exp $
#
# Script for generating a cache file with information about
# all binary packages contained in a directory.
@@ -47,6 +47,7 @@ AWK=${AWK:-awk}
CMP=${CMP:-cmp}
FIND=${FIND:-find}
GREP=${GREP:-grep}
+GZIP_CMD=${GZIP_CMD:-gzip}
PKG_INFO=${PKG_INFO:-pkg_info}
PKG_SUFX=${PKG_SUFX:-.tgz}
SED=${SED:-sed}
@@ -54,6 +55,7 @@ SORT=${SORT:-sort}
STAT=${STAT:-stat}
cachefile=.pkgcache
+summaryfile=pkg_summary
cacheversion=20050428
prompt="----> "
@@ -197,6 +199,15 @@ process_binpkg_dir(){
fi
fi
+ if test "${build_summary}" = "yes" -a ! -f ${d}/${summaryfile}.gz ; then
+ echo "${tab}Summary file ${d}/${summaryfile}.gz is missing and will be created."
+ need_update=yes
+ fi
+ if test "${build_summary}" = "yes" -a ${d}/${summaryfile}.gz -ot ${d}/${cachefile} ; then
+ echo "${tab}Summary file ${d}/${summaryfile}.gz is out of date and will be regnerated."
+ need_update=yes
+ fi
+
# FIX_ME
# We should use stale_entries in a way where we only update the
# cache file entries corresponding to these if we're rebuilding
@@ -204,6 +215,7 @@ process_binpkg_dir(){
#
if test "X${need_update}" = "Xyes" ; then
echo "pkgcache_version ${cacheversion}" > ${tmpd}/${cachefile}
+ echo "" > ${tmpd}/${summaryfile}
for f in ${d}/*${PKG_SUFX} ; do
fn=`grep "^${d} " ${all_dirs} | ${AWK} '{print $2}'`"/"`basename ${f}`
if test "X${DEBUG}" = "Xyes" ; then
@@ -215,10 +227,14 @@ process_binpkg_dir(){
#eval $(${STAT} -s ${f} 2>/dev/null)
echo "pkgcache_begin ${fn}" >> ${tmpd}/${cachefile}
#echo "pkgcache_mtime=${st_mtime}" >> ${tmpd}/${cachefile}
- if test "X${DEBUG}" = "Xyes" ; then
- echo "${PKG_INFO} -q -B ${f}"
- fi
+
+ if test "X${DEBUG}" = "Xyes" ; then echo "${PKG_INFO} -q -B ${f}" ; fi
${PKG_INFO} -q -B ${f} >> ${tmpd}/${cachefile}
+
+ if test "${build_summary}" = "yes" ; then
+ if test "X${DEBUG}" = "Xyes" ; then echo "${PKG_INFO} -X ${f}" ; fi
+ ${PKG_INFO} -X ${f} >> ${tmpd}/${summaryfile}
+ fi
echo "pkgcache_end ${fn}" >> ${tmpd}/${cachefile}
done
mv -f ${tmpd}/${cachefile} ${d}/${cachefile}
@@ -230,6 +246,18 @@ process_binpkg_dir(){
echo "********** WARNING **********"
return
fi
+
+ if test "${build_summary}" = "yes" ; then
+ cat ${tmpd}/${summaryfile} | ${GZIP_CMD} > ${d}/${summaryfile}.gz
+ if test $? -ne 0 ; then
+ echo "********** WARNING **********"
+ echo "${GZIP_CMD} of ${tmpd}/${summaryfile} to ${d}/${summaryfile}.gz failed!"
+ echo "Perhaps you do not have write permissions to ${d}?"
+ echo "********** WARNING **********"
+ return
+ fi
+ fi
+
fi
# if we got here, then this directory should have a good cache file in
@@ -280,6 +308,7 @@ process_cache_files(){
DEBUG=no
verbose=no
force=no
+build_summary=no
while
test -n "$1"
@@ -310,6 +339,12 @@ do
shift 2
;;
+ # Build the pkg_summary.gz files
+ -s|--summary)
+ build_summary=yes
+ shift
+ ;;
+
# Version
-V|--version)
${AWK} '/^#[ \t]*\$NetBSD/ {gsub(/,v/,"",$3);printf("%s: Version %s, %s\n",$3,$4,$5); exit 0;}' $prog
diff --git a/mk/scripts/genreadme.awk b/mk/scripts/genreadme.awk
index fcd769c4919..edf21c58adb 100755
--- a/mk/scripts/genreadme.awk
+++ b/mk/scripts/genreadme.awk
@@ -1,5 +1,5 @@
#!/usr/bin/awk -f
-# $NetBSD: genreadme.awk,v 1.22 2006/04/15 15:00:24 salo Exp $
+# $NetBSD: genreadme.awk,v 1.23 2006/07/28 02:41:07 dmcmahill Exp $
#
# Copyright (c) 2002, 2003, 2005, 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -201,8 +201,8 @@ END {
if ( builddependsfile == "" ) builddependsfile = "/dev/stdout";
printf("Making sure binary package cache file is up to date...\n");
- cmd = sprintf("%s AWK=%s CMP=%s FIND=%s GREP=%s PKG_INFO=\"%s\" PKG_SUFX=%s SED=%s SORT=%s %s/mk/scripts/binpkg-cache --packages %s",
- SETENV, AWK, CMP, FIND, GREP, PKG_INFO, PKG_SUFX, SED, SORT, PKGSRCDIR, PACKAGES);
+ cmd = sprintf("%s AWK=%s CMP=%s FIND=%s GREP=%s GZIP_CMD=\"%s\" PKG_INFO=\"%s\" PKG_SUFX=%s SED=%s SORT=%s %s/mk/scripts/binpkg-cache %s --packages %s",
+ SETENV, AWK, CMP, FIND, GREP, GZIP_CMD, PKG_INFO, PKG_SUFX, SED, SORT, PKGSRCDIR, summary, PACKAGES);
if (debug) printf("\nExecute: %s\n",cmd);
rc = system(cmd);
@@ -376,17 +376,17 @@ END {
toppkg, pkgbase);
}
while(i in vulpkg) {
- nm = vulpkg[i];
- gsub(/&/, "\\\\\\&amp;", nm);
- gsub(/</, "\\\\\\&lt;", nm);
- gsub(/>/, "\\\\\\&gt;", nm);
- url = vulref[i];
- gsub(/&/, "\\\\\\&", url);
- printurl = vulref[i];
- gsub(/&/, "\\\\\\&amp;", printurl);
- gsub(/</, "\\\\\\&lt;", printurl);
- gsub(/>/, "\\\\\\&gt;", printurl);
if (vulpkg[i] ~ "^" pkgbase"[-<>=]+[0-9]") {
+ nm = vulpkg[i];
+ gsub(/&/, "\\\\\\&amp;", nm);
+ gsub(/</, "\\\\\\&lt;", nm);
+ gsub(/>/, "\\\\\\&gt;", nm);
+ url = vulref[i];
+ gsub(/&/, "\\\\\\&", url);
+ printurl = vulref[i];
+ gsub(/&/, "\\\\\\&amp;", printurl);
+ gsub(/</, "\\\\\\&lt;", printurl);
+ gsub(/>/, "\\\\\\&gt;", printurl);
vul = sprintf("%s<LI><STRONG>%s has a <a href=\"%s\">%s</a> vulnerability</STRONG></LI>\n",
vul, nm, url, vultype[i]);
}
@@ -719,10 +719,17 @@ function reg2str(reg){
# an awk regular expression.
#
function glob2reg(reg){
+
+ # escape some characters which are special in regular expressions
gsub(/\./, "\\\.", reg);
gsub(/\+/, "\\\+", reg);
+
+ # and reformat some others
gsub(/\*/, ".*", reg);
gsub(/\?/, ".?", reg);
+
+ # finally, expand {a,b,c} type patterns
+
return(reg);
}
diff --git a/mk/scripts/mkreadme b/mk/scripts/mkreadme
index eaa90b0b1b6..92fffa77eae 100755
--- a/mk/scripts/mkreadme
+++ b/mk/scripts/mkreadme
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: mkreadme,v 1.10 2006/05/29 02:41:26 dmcmahill Exp $
+# $NetBSD: mkreadme,v 1.11 2006/07/28 02:41:07 dmcmahill Exp $
#
# Script for README.html generation
#
@@ -61,6 +61,7 @@ usage(){
echo "Usage: $prog [-c|--cdrom] [-C|--prune] [-d|--debug] [-f|--ftp] "
echo " [-p|--pkgsrc directory] "
echo " [-P|--packages directory] [-r|--restart] "
+ echo " [-s|--summary]"
echo " [-S|--save-database]"
echo " "
echo " $prog -h|--help"
@@ -90,6 +91,9 @@ usage(){
echo " from a previous run still exists and that the script"
echo " should use that instead of recreating the database."
echo " "
+ echo " -s|--summary Generate pkg_summary.gz files for the binary packages"
+ echo " directories while processing them."
+ echo " "
echo " -S|--save-database Does not delete the database file after the run."
echo " This is useful for debugging or re-running this script"
echo " with the -r option."
@@ -126,6 +130,8 @@ prune=no
DEBUG=no
save=no
+summary=""
+
while
test -n "$1"
do
@@ -181,6 +187,12 @@ do
shift
;;
+ # Generate the pkg_summary.gz files
+ -s|--summary)
+ summary="--summary"
+ shift
+ ;;
+
# Save the database files
-S|--save-database)
save=yes
@@ -247,7 +259,7 @@ echo " "
if [ -d ${PKGSRCDIR}/pkgtools/prereq-readme ]; then
cd ${PKGSRCDIR}/pkgtools/prereq-readme
eval "`${BMAKE} show-tools`"
- for v in AWK CMP ECHO EXPR FGREP FIND GREP SED SETENV SORT
+ for v in AWK CMP ECHO EXPR FGREP FIND GREP GZIP_CMD SED SETENV SORT
do
eval "echo '---->' ${v}=\"\${${v}}\""
done
@@ -397,11 +409,13 @@ ${AWK} -f ${PKGSRCDIR}/mk/scripts/genreadme.awk \
builddependsfile=${TMPDIR}/pkgsrc.builddepends.debug \
debug=$debug \
dependsfile=${TMPDIR}/pkgsrc.depends.debug \
+ summary=${summary} \
AWK=$AWK \
CMP=$CMP \
DISTDIR=$DISTDIR \
FIND=$FIND \
GREP=$GREP \
+ GZIP_CMD="$GZIP_CMD" \
PACKAGES=$PACKAGES \
PKG_INFO="$PKG_INFO" \
PKG_SUFX=$PKG_SUFX \
diff --git a/pkgtools/prereq-readme/Makefile b/pkgtools/prereq-readme/Makefile
index e05614e6157..225f1f090ff 100644
--- a/pkgtools/prereq-readme/Makefile
+++ b/pkgtools/prereq-readme/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2005/09/28 20:52:25 rillig Exp $
+# $NetBSD: Makefile,v 1.5 2006/07/28 02:41:07 dmcmahill Exp $
#
DISTNAME= prereq-readme-20050521
@@ -25,6 +25,7 @@ USE_TOOLS+= expr
USE_TOOLS+= fgrep
USE_TOOLS+= find
USE_TOOLS+= grep
+USE_TOOLS+= gzip
USE_TOOLS+= sed
USE_TOOLS+= setenv
USE_TOOLS+= sort