diff options
author | apb <apb> | 2008-05-02 19:10:26 +0000 |
---|---|---|
committer | apb <apb> | 2008-05-02 19:10:26 +0000 |
commit | 11dc851460a5f03e46b30e49c5805c302406505e (patch) | |
tree | fe6462c06b0d26caee6aa433e064b395c344bf9d /pkgtools/pkg_chk/files/pkg_chk.sh | |
parent | 2620aee0cba6a23f0e445c7a2ba5b5a1ba46d726 (diff) | |
download | pkgsrc-11dc851460a5f03e46b30e49c5805c302406505e.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/files/pkg_chk.sh')
-rwxr-xr-x | pkgtools/pkg_chk/files/pkg_chk.sh | 35 |
1 files changed, 24 insertions, 11 deletions
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 |