pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_chk Bump version to pkg_chk-1.91:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d6a36386b954
branches:  trunk
changeset: 542119:d6a36386b954
user:      apb <apb%pkgsrc.org@localhost>
date:      Fri May 02 19:10:26 2008 +0000

description:
Bump version to pkg_chk-1.91:
* Look for $MAKECONF in @MAKECONF@, @PREFIX@/etc/mk.conf,
  and /etc/mk.conf, in that order.
* Look for $PKGSRCDIR in the Makefile referred to by $MAKECONF,
  ".", "..", "../..", and "/usr/pkgsrc", in that order.
* Convert the Makefil to use the SUBST framework.

Proposed in tech-pkg; OK (in principle) David Brownlee

diffstat:

 pkgtools/pkg_chk/Makefile         |  39 +++++++++++++++------------------------
 pkgtools/pkg_chk/files/pkg_chk.8  |  27 +++++++++++++++++----------
 pkgtools/pkg_chk/files/pkg_chk.sh |  35 ++++++++++++++++++++++++-----------
 3 files changed, 56 insertions(+), 45 deletions(-)

diffs (173 lines):

diff -r a029384d9659 -r d6a36386b954 pkgtools/pkg_chk/Makefile
--- a/pkgtools/pkg_chk/Makefile Fri May 02 19:06:34 2008 +0000
+++ b/pkgtools/pkg_chk/Makefile Fri May 02 19:10:26 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.60 2008/04/23 21:55:29 abs Exp $
+# $NetBSD: Makefile,v 1.61 2008/05/02 19:10:26 apb Exp $
 
 DISTNAME=      pkg_chk-1.91
 CATEGORIES=    pkgtools
@@ -17,6 +17,7 @@
 USE_TOOLS+=    mktemp:run
 USE_TOOLS+=    gzip:run
 NO_CHECKSUM=   YES
+NO_BUILD=      yes
 
 CONFLICTS=     pkgchk-[0-9]*
 
@@ -24,32 +25,22 @@
 
 .include "../../mk/bsd.prefs.mk"
 
-# Avoid changing any the actual value of MAKECONF
-TMP_MAKECONF=${MAKECONF:U/etc/mk.conf}
+SUBST_CLASSES+=                vars
+SUBST_STAGE.vars=      pre-configure
+SUBST_MESSAGE.vars=    Configuring sources.
+SUBST_FILES.vars=      pkg_chk.sh pkg_chk.8
+SUBST_VARS.vars=       AWK GREP GZIP_CMD ID MAKE MAKECONF MKTEMP \
+                       PKG_ADD PKG_ADMIN PKG_DELETE PKG_INFO \
+                       SED SH SORT TSORT PREFIX PKG_DBDIR XARGS
 
-do-build:
-       ${SED} -e 's#@AWK@#${AWK}#g' \
-         -e 's#@GREP@#${GREP}#g' \
-         -e 's#@GZIP_CMD@#${GZIP_CMD}#g' \
-         -e 's#@ID@#${ID}#g' \
-         -e 's#@MAKE@#${MAKE}#g' \
-         -e 's#@MAKECONF@#${TMP_MAKECONF}#g' \
-         -e 's#@MKTEMP@#${MKTEMP}#g' \
-         -e 's#@PKG_ADD@#${PKG_ADD}#g' \
-         -e 's#@PKG_ADMIN@#${PKG_ADMIN}#g' \
-         -e 's#@PKG_DELETE@#${PKG_DELETE}#g' \
-         -e 's#@PKG_INFO@#${PKG_INFO}#g' \
-         -e 's#@SED@#${SED}#g' \
-         -e 's#@SH@#${SH}#g' \
-         -e 's#@SORT@#${SORT}#g' \
-         -e 's#@TSORT@#${TSORT}#g' \
-         -e 's#@PREFIX@#${PREFIX}#g' \
-         -e 's#@PKG_DBDIR@#${PKG_DBDIR}#g' \
-         -e 's#@XARGS@#${XARGS}#g' \
-         ${FILESDIR}/pkg_chk.sh >${WRKSRC}/pkg_chk.sh
+REPLACE_SH+=           pkg_chk.sh
+
+do-extract:
+       cp ${FILESDIR}/pkg_chk.sh ${WRKSRC}
+       cp ${FILESDIR}/pkg_chk.8 ${WRKSRC}
 
 do-install:
        ${INSTALL_SCRIPT} ${WRKSRC}/pkg_chk.sh ${PREFIX}/sbin/pkg_chk
-       ${INSTALL_MAN} ${FILESDIR}/pkg_chk.8 ${PREFIX}/${PKGMANDIR}/man8/pkg_chk.8
+       ${INSTALL_MAN} ${WRKSRC}/pkg_chk.8 ${PREFIX}/${PKGMANDIR}/man8/pkg_chk.8
 
 .include "../../mk/bsd.pkg.mk"
diff -r a029384d9659 -r d6a36386b954 pkgtools/pkg_chk/files/pkg_chk.8
--- a/pkgtools/pkg_chk/files/pkg_chk.8  Fri May 02 19:06:34 2008 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.8  Fri May 02 19:10:26 2008 +0000
@@ -1,9 +1,9 @@
-.\"    $NetBSD: pkg_chk.8,v 1.25 2007/08/27 15:28:54 abs Exp $
+.\"    $NetBSD: pkg_chk.8,v 1.26 2008/05/02 19:10:26 apb Exp $
 .\"
 .\" Copyright (c) 2001 by David Brownlee (abs%NetBSD.org@localhost)
 .\" Absolutely no warranty.
 .\"
-.Dd September 29, 2006
+.Dd May 2, 2008
 .Dt PKG_CHK 8
 .Sh NAME
 .Nm pkg_chk
@@ -268,20 +268,27 @@
 .Nm
 uses the following environment variables.
 .Bl -tag -width xxxx
+.It Ev MAKECONF
+Path to
+.Pa mk.conf .
+Defaults to
+.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
+or
+.Pa /etc/mk.conf .
 .It Ev PKGSRCDIR
 Base of pkgsrc tree.
-If not set in environment then read from
-.Pa ${MAKECONF}
-or
-.Pa /etc/mk.conf .
-Defaults to
+If not set in the environment, then this variable is read from
+.Pa ${MAKECONF} .
+If it is still not set, and if the current working directory
+appears to be inside a pkgsrc tree, then this variable
+is set to the base of that pkgsrc tree.
+Finally, if
 .Pa /usr/pkgsrc
+appears to contain a pkgsrc tree, then that is used as a last resort.
 .It Ev PKG_DBDIR
 pkgsrc database directory.
 If not set in environment then read from
-.Pa ${MAKECONF}
-or
-.Pa /etc/mk.conf .
+.Pa ${MAKECONF} .
 Defaults to
 .Pa /var/db/pkg
 .It Ev PACKAGES
diff -r a029384d9659 -r d6a36386b954 pkgtools/pkg_chk/files/pkg_chk.sh
--- a/pkgtools/pkg_chk/files/pkg_chk.sh Fri May 02 19:06:34 2008 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh Fri May 02 19:10:26 2008 +0000
@@ -1,6 +1,6 @@
 #!@SH@ -e
 #
-# $Id: pkg_chk.sh,v 1.56 2008/04/23 21:55:29 abs Exp $
+# $Id: pkg_chk.sh,v 1.57 2008/05/02 19:10:26 apb Exp $
 #
 # TODO: Make -g check dependencies and tsort
 # TODO: Variation of -g which only lists top level packages
@@ -158,9 +158,20 @@
 
 extract_variables()
     {
-    extract_mk_var PKGSRCDIR /usr/pkgsrc
-    if [ ! -d $PKGSRCDIR -a -z "$opt_b" ] ; then
-       fatal "Unable to locate PKGSRCDIR ($PKGSRCDIR)"
+    extract_mk_var PKGSRCDIR ''
+    if [ -z "$PKGSRCDIR" ] ; then
+       for dir in . .. ../.. /usr/pkgsrc ; do
+           if [ -f "${dir}/mk/bsd.pkg.mk" ]; then
+               case "${dir}" in
+               /*) PKGSRCDIR="${dir}" ;;
+               *)  PKGSRCDIR="$( cd "${dir}" >/dev/null 2>&1 && pwd )" ;;
+               esac
+               break
+           fi
+       done
+    fi
+    if [ ! -d $PKGSRCDIR -a \( -z "$opt_b" -o -n "$opt_s" \) ] ; then
+       fatal "Unable to locate PKGSRCDIR (${PKGSRCDIR:-not set})"
     fi
 
     # Now we have PKGSRCDIR, use it to determine PACKAGES, and PKGCHK_CONF
@@ -750,14 +761,16 @@
 test -n "$MY_TMPDIR" || fatal "Couldn't create temporary directory."
 MY_TMPFILE=$MY_TMPDIR/tmp
 
+if [ -z "$MAKECONF" ] ; then
+    for mkconf in "@MAKECONF@" "@PREFIX@/etc/mk.conf" /etc/mk.conf ; do
+       if [ -f "$mkconf" ] ; then
+           MAKECONF="$mkconf"
+           break
+       fi
+    done
+fi
 if [ -z "$MAKECONF" -o ! -f "$MAKECONF" ] ; then
-    if [ -f @PREFIX@/etc/mk.conf ] ; then
-       MAKECONF=@PREFIX@/etc/mk.conf
-    elif [ -f /etc/mk.conf ] ; then
-       MAKECONF=/etc/mk.conf
-    else
-       MAKECONF=/dev/null
-    fi
+    MAKECONF=/dev/null
 fi
 verbose_var MAKECONF
 



Home | Main Index | Thread Index | Old Index