summaryrefslogtreecommitdiff
path: root/mk/scripts
diff options
context:
space:
mode:
authordmcmahill <dmcmahill@pkgsrc.org>2006-01-05 22:19:42 +0000
committerdmcmahill <dmcmahill@pkgsrc.org>2006-01-05 22:19:42 +0000
commit0cabd7311d2bfecbb83afc2deb0d014d16882230 (patch)
tree922d33363e5646558af422c4b423afe97201be29 /mk/scripts
parentcdbd1711db24c647650eb99de2da306ecb095158 (diff)
downloadpkgsrc-0cabd7311d2bfecbb83afc2deb0d014d16882230.tar.gz
Fix a bug which caused the README.html generation to fail when the packages
directory did not exist. Now the generation completes with a warning that no binary packages were found. Reported in PR pkg/32351.
Diffstat (limited to 'mk/scripts')
-rwxr-xr-xmk/scripts/binpkg-cache14
-rwxr-xr-xmk/scripts/genreadme.awk22
2 files changed, 26 insertions, 10 deletions
diff --git a/mk/scripts/binpkg-cache b/mk/scripts/binpkg-cache
index 81d0d0f3398..1115cfbc2c8 100755
--- a/mk/scripts/binpkg-cache
+++ b/mk/scripts/binpkg-cache
@@ -1,11 +1,11 @@
#!/bin/sh
#
-# $NetBSD: binpkg-cache,v 1.6 2005/05/24 21:48:22 dmcmahill Exp $
+# $NetBSD: binpkg-cache,v 1.7 2006/01/05 22:19:42 dmcmahill Exp $
#
# Script for generating a cache file with information about
# all binary packages contained in a directory.
#
-# Copyright (c) 2005 The NetBSD Foundation, Inc.
+# Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
@@ -95,6 +95,9 @@ usage(){
echo " "
echo " -v|--version Displays the version of this script and exits."
echo " "
+ echo "Returns 0 on success, 1 on errors, 2 if the packages"
+ echo "directory does not exist."
+ echo " "
echo "Example: $prog -v --packages /usr/pkgsrc/packages"
echo " "
}
@@ -109,6 +112,11 @@ clean_and_exit1(){
exit 1
}
+clean_and_exit2(){
+ rm -fr ${tmpd}
+ exit 2
+}
+
all_cache_files=""
#############################################################################
@@ -326,7 +334,7 @@ fi
if test ! -d ${PACKAGES} ; then
echo "Packages directory ${PACKAGES} seems to be missing"
- clean_and_exit1
+ clean_and_exit2
fi
# put a trailing / after ${PACKAGES} in case ${PACKAGES} is
diff --git a/mk/scripts/genreadme.awk b/mk/scripts/genreadme.awk
index 567833f1fc5..6028ad38470 100755
--- a/mk/scripts/genreadme.awk
+++ b/mk/scripts/genreadme.awk
@@ -1,7 +1,7 @@
#!/usr/bin/awk -f
-# $NetBSD: genreadme.awk,v 1.19 2005/05/22 01:37:31 dmcmahill Exp $
+# $NetBSD: genreadme.awk,v 1.20 2006/01/05 22:19:42 dmcmahill Exp $
#
-# Copyright (c) 2002, 2003, 2005 The NetBSD Foundation, Inc.
+# Copyright (c) 2002, 2003, 2005, 2006 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
@@ -206,17 +206,25 @@ END {
if (debug) printf("\nExecute: %s\n",cmd);
rc = system(cmd);
- if (rc != 0) {
+ if (rc != 0 && rc != 2) {
printf("\n**** WARNING ****\n") > "/dev/stderr";
printf("Command: %s\nfailed.", cmd) > "/dev/stderr";
printf("**** ------- ****\n") > "/dev/stderr";
exit(1);
}
- printf("Loading binary package cache file...\n");
- load_cache_file( PACKAGES "/.pkgcache" );
- if(pkg_count["unknown"] > 0 ) {
- printf(" Loaded %d binary packages with unknown PKGPATH\n", pkg_count["unknown"]);
+ if (rc == 2) {
+ printf("\n**** WARNING ****\n") > "/dev/stderr";
+ printf("* No binary packages directory found\n") > "/dev/stderr";
+ printf("* List of binary packages will not be generated\n") > "/dev/stderr";
+ printf("**** ------- ****\n") > "/dev/stderr";
+ } else {
+
+ printf("Loading binary package cache file...\n");
+ load_cache_file( PACKAGES "/.pkgcache" );
+ if(pkg_count["unknown"] > 0 ) {
+ printf(" Loaded %d binary packages with unknown PKGPATH\n", pkg_count["unknown"]);
+ }
}
printf("Flattening dependencies\n");