summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_chk
diff options
context:
space:
mode:
authorapb <apb@pkgsrc.org>2008-05-02 19:10:26 +0000
committerapb <apb@pkgsrc.org>2008-05-02 19:10:26 +0000
commit32be79e91111f62dc42898f7565b45d79623541c (patch)
treefe6462c06b0d26caee6aa433e064b395c344bf9d /pkgtools/pkg_chk
parentffe71bd20aa9537c3eab8b589ab6faa322501c5b (diff)
downloadpkgsrc-32be79e91111f62dc42898f7565b45d79623541c.tar.gz
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 (limited to 'pkgtools/pkg_chk')
-rw-r--r--pkgtools/pkg_chk/Makefile41
-rw-r--r--pkgtools/pkg_chk/files/pkg_chk.827
-rwxr-xr-xpkgtools/pkg_chk/files/pkg_chk.sh35
3 files changed, 57 insertions, 46 deletions
diff --git a/pkgtools/pkg_chk/Makefile b/pkgtools/pkg_chk/Makefile
index 7df350f3972..cfd9e17ff8b 100644
--- a/pkgtools/pkg_chk/Makefile
+++ b/pkgtools/pkg_chk/Makefile
@@ -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_LANGUAGES= # empty
USE_TOOLS+= mktemp:run
USE_TOOLS+= gzip:run
NO_CHECKSUM= YES
+NO_BUILD= yes
CONFLICTS= pkgchk-[0-9]*
@@ -24,32 +25,22 @@ INSTALLATION_DIRS= sbin ${PKGMANDIR}/man8
.include "../../mk/bsd.prefs.mk"
-# Avoid changing any the actual value of MAKECONF
-TMP_MAKECONF=${MAKECONF:U/etc/mk.conf}
-
-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
+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
+
+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 --git a/pkgtools/pkg_chk/files/pkg_chk.8 b/pkgtools/pkg_chk/files/pkg_chk.8
index dea7a73540a..a77d009e6df 100644
--- a/pkgtools/pkg_chk/files/pkg_chk.8
+++ b/pkgtools/pkg_chk/files/pkg_chk.8
@@ -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)
.\" Absolutely no warranty.
.\"
-.Dd September 29, 2006
+.Dd May 2, 2008
.Dt PKG_CHK 8
.Sh NAME
.Nm pkg_chk
@@ -268,20 +268,27 @@ option.
.Nm
uses the following environment variables.
.Bl -tag -width xxxx
-.It Ev PKGSRCDIR
-Base of pkgsrc tree.
-If not set in environment then read from
-.Pa ${MAKECONF}
+.It Ev MAKECONF
+Path to
+.Pa mk.conf .
+Defaults to
+.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
or
.Pa /etc/mk.conf .
-Defaults to
+.It Ev PKGSRCDIR
+Base of pkgsrc tree.
+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 --git a/pkgtools/pkg_chk/files/pkg_chk.sh b/pkgtools/pkg_chk/files/pkg_chk.sh
index 65271bc367a..3ab61e1e879 100755
--- a/pkgtools/pkg_chk/files/pkg_chk.sh
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh
@@ -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_pkg_vars()
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 @@ MY_TMPDIR=`${MKTEMP} -d ${TMPDIR-/tmp}/${0##*/}.XXXXXX`
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