pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/scripts Fix a bug which caused the README.html gene...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/42c35627123c
branches:  trunk
changeset: 505650:42c35627123c
user:      dmcmahill <dmcmahill%pkgsrc.org@localhost>
date:      Thu Jan 05 22:19:42 2006 +0000

description:
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:

 mk/scripts/binpkg-cache  |  14 +++++++++++---
 mk/scripts/genreadme.awk |  22 +++++++++++++++-------
 2 files changed, 26 insertions(+), 10 deletions(-)

diffs (92 lines):

diff -r 868237b0ab4a -r 42c35627123c mk/scripts/binpkg-cache
--- a/mk/scripts/binpkg-cache   Thu Jan 05 21:57:36 2006 +0000
+++ b/mk/scripts/binpkg-cache   Thu Jan 05 22:19:42 2006 +0000
@@ -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 @@
        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 @@
        exit 1
 }
 
+clean_and_exit2(){
+       rm -fr ${tmpd}
+       exit 2
+}
+
 all_cache_files=""
 
 #############################################################################
@@ -326,7 +334,7 @@
 
 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 -r 868237b0ab4a -r 42c35627123c mk/scripts/genreadme.awk
--- a/mk/scripts/genreadme.awk  Thu Jan 05 21:57:36 2006 +0000
+++ b/mk/scripts/genreadme.awk  Thu Jan 05 22:19:42 2006 +0000
@@ -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 @@
        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");



Home | Main Index | Thread Index | Old Index