diff options
author | tron <tron> | 2002-06-09 14:43:39 +0000 |
---|---|---|
committer | tron <tron> | 2002-06-09 14:43:39 +0000 |
commit | be4d1abab84b29614c79adab5a8e82070a72cecd (patch) | |
tree | e7519665422f334f5cf0701b1c5385089657c16d /pkgtools/pkgchk | |
parent | 6de48de8106bd01b9000063ab5fd4aaa2688ba11 (diff) | |
download | pkgsrc-be4d1abab84b29614c79adab5a8e82070a72cecd.tar.gz |
Add support for "$PKG_DBDIR" and "$MAKECONF". Based on patches supplied
by Jonathan Perkin in PR pkg/17069. Bump version number 1.29.
Diffstat (limited to 'pkgtools/pkgchk')
-rw-r--r-- | pkgtools/pkgchk/Makefile | 9 | ||||
-rw-r--r-- | pkgtools/pkgchk/files/pkgchk.8 | 11 | ||||
-rwxr-xr-x | pkgtools/pkgchk/files/pkgchk.sh | 37 |
3 files changed, 44 insertions, 13 deletions
diff --git a/pkgtools/pkgchk/Makefile b/pkgtools/pkgchk/Makefile index acddc457b86..95e6317c091 100644 --- a/pkgtools/pkgchk/Makefile +++ b/pkgtools/pkgchk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.29 2002/04/01 20:20:05 abs Exp $ +# $NetBSD: Makefile,v 1.30 2002/06/09 14:43:39 tron Exp $ -DISTNAME= pkgchk-1.28 +DISTNAME= pkgchk-1.29 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty @@ -14,8 +14,9 @@ NO_CHECKSUM= YES WRKSRC= ${WRKDIR} do-build: - ${SED} -e 's#@MAKE@#${MAKE}#g' ${FILESDIR}/pkgchk.sh \ - >${WRKSRC}/pkgchk.sh + ${SED} -e 's#@MAKE@#${MAKE}#g' \ + -e 's#@MAKECONF@#${MAKECONF}#g' \ + ${FILESDIR}/pkgchk.sh >${WRKSRC}/pkgchk.sh do-install: ${INSTALL_SCRIPT} ${WRKSRC}/pkgchk.sh ${PREFIX}/sbin/pkg_chk diff --git a/pkgtools/pkgchk/files/pkgchk.8 b/pkgtools/pkgchk/files/pkgchk.8 index 3ad826e7f99..e4978fe0e59 100644 --- a/pkgtools/pkgchk/files/pkgchk.8 +++ b/pkgtools/pkgchk/files/pkgchk.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkgchk.8,v 1.12 2002/03/17 22:47:40 abs Exp $ +.\" $NetBSD: pkgchk.8,v 1.13 2002/06/09 14:43:39 tron Exp $ .\" .\" Copyright (c) 2001 by David Brownlee (abs@netbsd.org) .\" Absolutely no warranty. @@ -150,9 +150,18 @@ 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} +or .Pa /etc/mk.conf . Defaults to .Pa /usr/pkgsrc +.It Ev PKG_DBDIR +pkgsrc database directory. If not set in environment then read from +.Pa ${MAKECONF} +or +.Pa /etc/mk.conf . +Defaults to +.Pa /var/db/pkg .It Ev PACKAGES Location of binary packages. If not set in environment then read from .Pa /etc/mk.conf . diff --git a/pkgtools/pkgchk/files/pkgchk.sh b/pkgtools/pkgchk/files/pkgchk.sh index fcd5905c955..ac127b1b615 100755 --- a/pkgtools/pkgchk/files/pkgchk.sh +++ b/pkgtools/pkgchk/files/pkgchk.sh @@ -1,6 +1,6 @@ #!/bin/sh -e # -# $Id: pkgchk.sh,v 1.31 2002/04/01 20:20:05 abs Exp $ +# $Id: pkgchk.sh,v 1.32 2002/06/09 14:43:39 tron Exp $ # # TODO: Handle updates with dependencies via binary packages @@ -28,7 +28,7 @@ check_packages_installed() echo "Unable to extract PKGNAME for $pkgdir" exit 1 fi - if [ ! -d /var/db/pkg/$PKGNAME ];then + if [ ! -d $PKG_DBDIR/$PKGNAME ];then echo_n "$PKGNAME: " pkg=`echo $PKGNAME | sed 's/-[0-9].*//'` pkginstalled=`sh -c "${PKG_INFO} -e $pkg" || true` @@ -48,7 +48,7 @@ check_packages_installed() else if [ -n "$opt_B" ];then current_build_ver=`get_build_ver` - installed_build_ver=`sed "s|^[^:]*/[^:]*:||" /var/db/pkg/$PKGNAME/+BUILD_VERSION` + installed_build_ver=`sed "s|^[^:]*/[^:]*:||" $PKG_DBDIR/$PKGNAME/+BUILD_VERSION` if [ x"$current_build_ver" != x"$installed_build_ver" ];then echo "$PKGNAME: build version information mismatch" MISMATCH_TODO="$MISMATCH_TODO $PKGNAME" @@ -84,7 +84,9 @@ extract_variables() # if [ -z "$PKGSRCDIR" ];then - if [ -f /etc/mk.conf ] ;then + if [ -f $MAKECONF ];then + eval `printf 'BSD_PKG_MK=1\nx:\n\t@echo PKGSRCDIR=${PKGSRCDIR}\n' | ${MAKE} -f - -f $MAKECONF x` + elif [ -f /etc/mk.conf ];then eval `printf 'BSD_PKG_MK=1\nx:\n\t@echo PKGSRCDIR=${PKGSRCDIR}\n' | ${MAKE} -f - -f /etc/mk.conf x` fi if [ -z "$PKGSRCDIR" ];then @@ -96,6 +98,24 @@ extract_variables() exit 1; fi + # Establish PKG_DBDIR + # + + if [ -z "$PKG_DBDIR" ];then + if [ -f $MAKECONF ];then + eval `printf 'BSD_PKG_MK=1\nx:\n\t@echo PKG_DBDIR=${PKG_DBDIR}\n' | ${MAKE} -f - -f $MAKECONF x` + elif [ -f /etc/mk.conf ];then + eval `printf 'BSD_PKG_MK=1\nx:\n\t@echo PKG_DBDIR=${PKG_DBDIR}\n' | ${MAKE} -f - -f /etc/mk.conf x` + fi + if [ -z "$PKG_DBDIR" ];then + PKG_DBDIR=/var/db/pkg + fi + fi + if [ ! -d $PKG_DBDIR ];then + echo "Unable to locate PKG_DBDIR '$PKG_DBDIR'" + exit 1; + fi + # Now we have PKGSRCDIR, use it to determine PACKAGES, and PKGCHK_CONF # as well as AWK, GREP, SED, PKGCHK_TAGS and PKGCHK_NOTAGS # @@ -159,7 +179,7 @@ pkg_install() PKGDIR=$2 INSTALL=$3 - if [ -d /var/db/pkg/$PKGNAME ];then + if [ -d $PKG_DBDIR/$PKGNAME ];then echo "$PKGNAME installed in previous stage" elif [ -n "$opt_b" -a -f $PACKAGES/All/$PKGNAME.tgz ] ; then if [ $INSTALL = Update ];then @@ -175,7 +195,7 @@ pkg_install() run_cmd "cd $PKGSRCDIR/$PKGDIR && ${MAKE} update" fi - if [ -z "$opt_n" -a ! -d /var/db/pkg/$PKGNAME ];then + if [ -z "$opt_n" -a ! -d $PKG_DBDIR/$PKGNAME ];then FAIL=1 fi @@ -294,6 +314,7 @@ on hostname and type, see pkg_chk(8). fi test -n "$MAKE" || MAKE="@MAKE@" +test -n "$MAKECONF" || MAKECONF="@MAKECONF@" # grabbed from GNU configure if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then @@ -423,8 +444,8 @@ if [ -n "$UPDATE_TODO" ];then set -- $UPDATE_TODO while [ $# != 0 ]; do PKGNAME=`echo $1 | sed 's/-[0-9].*//'` - if [ -f /var/db/pkg/$PKGNAME-[0-9]*/+REQUIRED_BY ];then - LIST="$LIST$1|$2|`cat /var/db/pkg/$PKGNAME-[0-9]*/+REQUIRED_BY | xargs echo`\n" + if [ -f $PKG_DBDIR/$PKGNAME-[0-9]*/+REQUIRED_BY ];then + LIST="$LIST$1|$2|`cat $PKG_DBDIR/$PKGNAME-[0-9]*/+REQUIRED_BY | xargs echo`\n" else LIST="$LIST$1|$2\n" fi |