pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/bulk - Rewrote the "man page" comment.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/df99a5b7e58d
branches:  trunk
changeset: 502528:df99a5b7e58d
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Nov 05 18:34:45 2005 +0000

description:
- Rewrote the "man page" comment.
- When printindex is called with two arguments, the second argument
  specifies the base directory of the <brokenfile>. The complete path is
  then <brokenbasedir>/${pkgdir}/<brokenfile>. This is useful for creating
  the log files in a directory outside the pkgsrc root.

diffstat:

 mk/bulk/printindex |  43 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 32 insertions(+), 11 deletions(-)

diffs (84 lines):

diff -r 04237f57587b -r df99a5b7e58d mk/bulk/printindex
--- a/mk/bulk/printindex        Sat Nov 05 17:53:44 2005 +0000
+++ b/mk/bulk/printindex        Sat Nov 05 18:34:45 2005 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: printindex,v 1.17 2005/11/05 14:01:07 rillig Exp $
+# $NetBSD: printindex,v 1.18 2005/11/05 18:34:45 rillig Exp $
 #
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,25 +37,36 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-
-# Generate package index.  If an argument is given, use it as a file name
-# to contain any failure messages in each package directory.
+# usage: printindex [brokenfile [brokenbasedir]]
+#
+# Generates a mapping from pkgsrc directories to the current package
+# version and prints it on stdout. Each line of the output has two
+# fields: the package directory (in the form category/package) and the
+# package version (in the form package-1.456nb3).
 #
-# generates a pkgsrc directory <-> package name database.  eg.
-#              foo/bar  bar-2.0
-#              foo/baz  baz-1.0.1
+# If the optional argument <brokenfile> is given, it specifies the
+# basename of the file to which package-specific errors will be
+# appended.
 #
-# Start in $USR_PKGSRC.
+# If the <brokenbasedir> is specified, the complete filename of the
+# <brokenfile> is <brokenbasedir>/${pkgdir}/<brokenfile>. This
+# directory is created automatically if needed. If the <brokenbasedir>
+# is not specified, the <brokenfile> is created in the package directory
+# itself.
 #
+# Note: printindex must be called from a pkgsrc root directory.
 
 set -e
 
+have_brokenbasedir="no"
 case $# in
 0)     brokenfile="/dev/null"
        ;;
 1)     brokenfile="$1"
        ;;
-*)     echo "usage: $0 [brokenfile]" 1>&2
+2)     brokenfile="$1"; brokenbasedir="$2"; have_brokenbasedir="yes"
+       ;;
+*)     echo "usage: $0 [brokenfile [brokenbasedir]]" 1>&2
        exit 1
        ;;
 esac
@@ -72,6 +83,7 @@
 cd "${cwd}/pkgtools/pkglint"
 BULK_PREREQ=`${BMAKE} show-var VARNAME=BULK_PREREQ`
 GREP=`${BMAKE} show-var VARNAME=GREP USE_TOOLS=grep`
+MKDIR=`${BMAKE} show-var VARNAME=MKDIR USE_TOOLS=mkdir`
 SED=`${BMAKE} show-var VARNAME=SED USE_TOOLS=sed`
 cd "${cwd}"
 
@@ -102,9 +114,18 @@
                        done_pkgs="${done_pkgs} =${pkgdir}="
                else
                        echo "$0: error: could not extract PKGNAME for ${pkgdir} -- skipping." 1>&2
+
+                       case $have_brokenbasedir in
+                       yes)    brokendir="${brokenbasedir}/${pkgdir}"
+                               ${MKDIR} "${brokendir}"
+                               ;;
+                       *)      brokendir="."
+                               ;;
+                       esac
+
                        { echo "===> ${BMAKE} show-var VARNAME=PKGNAME failed"
-                         cd "${cwd}/${pkgdir}" && ${BMAKE} show-var VARNAME=PKGNAME || true
-                       } >> "${brokenfile}" 2>&1
+                         ${BMAKE} show-var VARNAME=PKGNAME || true
+                       } >> "${brokendir}/${brokenfile}" 2>&1
                fi
        fi
 done



Home | Main Index | Thread Index | Old Index