diff options
author | joerg <joerg@pkgsrc.org> | 2018-01-13 12:48:56 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2018-01-13 12:48:56 +0000 |
commit | 6af6f692a5cb2789387901c734dc1034bf2029bc (patch) | |
tree | 88827c89d01c3bea6c152f45d90777e1132c9804 /mk | |
parent | 8a0bb61db39fde12b40c9a2e605d8277768fc3a3 (diff) | |
download | pkgsrc-6af6f692a5cb2789387901c734dc1034bf2029bc.tar.gz |
Introduce TEST_DEPENDS.
Place them in ALL_DEPENDS iff PKGSRC_RUN_TESTS is set, so that bulk
builds will pick them up.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 3 | ||||
-rw-r--r-- | mk/bsd.utils.mk | 5 | ||||
-rw-r--r-- | mk/build/test.mk | 3 | ||||
-rw-r--r-- | mk/depends/bsd.depends.mk | 4 | ||||
-rw-r--r-- | mk/pkgformat/pkg/depends.mk | 52 | ||||
-rwxr-xr-x | mk/pkgformat/pkg/list-dependencies | 11 | ||||
-rwxr-xr-x | mk/pkgformat/pkg/resolve-dependencies | 1 |
7 files changed, 63 insertions, 16 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index a92c8b267db..d2c07465e6c 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.2029 2018/01/02 05:49:44 maya Exp $ +# $NetBSD: bsd.pkg.mk,v 1.2030 2018/01/13 12:48:56 joerg Exp $ # # This file is in the public domain. # @@ -93,6 +93,7 @@ MAINTAINER=${OWNER} MAINTAINER?= pkgsrc-users@NetBSD.org .endif PKGWILDCARD?= ${PKGBASE}-[0-9]* +TEST_DEPENDS?= # empty TOOL_DEPENDS?= # empty .if defined(GITHUB_TAG) WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//} diff --git a/mk/bsd.utils.mk b/mk/bsd.utils.mk index 0ef2240d975..9494cf04d1a 100644 --- a/mk/bsd.utils.mk +++ b/mk/bsd.utils.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.utils.mk,v 1.10 2013/05/09 23:37:25 riastradh Exp $ +# $NetBSD: bsd.utils.mk,v 1.11 2018/01/13 12:48:56 joerg Exp $ # # This Makefile fragment is included by bsd.pkg.mk and defines utility # and otherwise miscellaneous variables and targets. @@ -11,6 +11,9 @@ DEPENDS_TYPE?= all .if !empty(DEPENDS_TYPE:Mbuild) || !empty(DEPENDS_TYPE:Mall) _ALL_DEPENDS+= ${BOOTSTRAP_DEPENDS} ${BUILD_DEPENDS} ${TOOL_DEPENDS} +. if !empty(PKGSRC_RUN_TESTS:M[yY][eE][sS]) +_ALL_DEPENDS+= ${TEST_DEPENDS} +. endif .endif .if !empty(DEPENDS_TYPE:Minstall) || !empty(DEPENDS_TYPE:Mpackage) || \ !empty(DEPENDS_TYPE:Mall) diff --git a/mk/build/test.mk b/mk/build/test.mk index 5263b61b185..8c79847a875 100644 --- a/mk/build/test.mk +++ b/mk/build/test.mk @@ -1,4 +1,4 @@ -# $NetBSD: test.mk,v 1.18 2012/05/27 14:32:29 cheusov Exp $ +# $NetBSD: test.mk,v 1.19 2018/01/13 12:48:56 joerg Exp $ # # After the "build" phase, many packages provide some sort of self-test # that can be run on the not-yet installed package. To enable these @@ -58,6 +58,7 @@ TEST_MAKE_CMD= \ ### _TEST_TARGETS+= check-vulnerable _TEST_TARGETS+= build +_TEST_TARGETS+= test-depends _TEST_TARGETS+= acquire-test-lock _TEST_TARGETS+= ${_COOKIE.test} _TEST_TARGETS+= release-test-lock diff --git a/mk/depends/bsd.depends.mk b/mk/depends/bsd.depends.mk index 18f11e36791..24c6f2c90db 100644 --- a/mk/depends/bsd.depends.mk +++ b/mk/depends/bsd.depends.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.depends.mk,v 1.27 2018/01/02 01:01:42 rillig Exp $ +# $NetBSD: bsd.depends.mk,v 1.28 2018/01/13 12:48:56 joerg Exp $ # # This Makefile fragment is included by bsd.pkg.mk and provides all # variables and targets related to dependencies. @@ -110,7 +110,7 @@ depends-cookie: # Command line variables: # # VARNAME -# DEPENDS, BUILD_DEPENDS, or TOOL_DEPENDS. +# DEPENDS, BUILD_DEPENDS, TEST_DEPENDS, or TOOL_DEPENDS. # # Keywords: depends dependencies show-depends: .PHONY _pkgformat-show-depends diff --git a/mk/pkgformat/pkg/depends.mk b/mk/pkgformat/pkg/depends.mk index 1f80669cc92..c866d1841df 100644 --- a/mk/pkgformat/pkg/depends.mk +++ b/mk/pkgformat/pkg/depends.mk @@ -1,4 +1,4 @@ -# $NetBSD: depends.mk,v 1.5 2016/07/18 09:57:10 leot Exp $ +# $NetBSD: depends.mk,v 1.6 2018/01/13 12:48:57 joerg Exp $ # This command prints out the dependency patterns for all full (run-time) # dependencies of the package. @@ -11,7 +11,7 @@ # # <depends_type> <pattern> <directory> # -# Valid dependency types are "bootstrap", "build" and "full". +# Valid dependency types are "bootstrap", "build", "test" and "full". # # ${_RDEPENDS_FILE} contains the resolved dependency information # for the package. For each line in ${_DEPENDS_FILE} @@ -52,6 +52,7 @@ _REDUCE_RESOLVED_DEPENDS_CMD=${PKGSRC_SETENV} CAT=${CAT:Q} \ _pkgformat-show-depends: .PHONY @case ${VARNAME:Q}"" in \ BUILD_DEPENDS) ${_REDUCE_DEPENDS_CMD} ${BUILD_DEPENDS:Q} ;; \ + TEST_DEPENDS) ${_HOST_REDUCE_DEPENDS_CMD} ${TEST_DEPENDS:Q} ;;\ TOOL_DEPENDS) ${_HOST_REDUCE_DEPENDS_CMD} ${TOOL_DEPENDS:Q} ;;\ DEPENDS|*) ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} ;; \ esac @@ -61,6 +62,7 @@ _LIST_DEPENDS_CMD= \ PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \ ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \ " "${BOOTSTRAP_DEPENDS:Q} \ + " "${TEST_DEPENDS:Q} \ " "${TOOL_DEPENDS:Q} \ " "${BUILD_DEPENDS:Q} \ " "${DEPENDS:Q} @@ -71,12 +73,19 @@ _LIST_DEPENDS_CMD.bootstrap= \ ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \ " "${BOOTSTRAP_DEPENDS:Q} " " " " " " +_LIST_DEPENDS_CMD.test= \ + ${PKGSRC_SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \ + PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \ + ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/list-dependencies \ + " " " "${TEST_DEPENDS:Q} " " " " " " + _RESOLVE_DEPENDS_CMD= \ ${PKGSRC_SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} PKG_INFO=${PKG_INFO:Q} \ HOST_PKG_INFO=${HOST_PKG_INFO:Q} \ _DEPENDS_FILE=${_DEPENDS_FILE:Q} \ ${SH} ${PKGSRCDIR}/mk/pkgformat/pkg/resolve-dependencies \ " "${BOOTSTRAP_DEPENDS:Q} \ + " " \ " "${TOOL_DEPENDS:Q} \ " "${BUILD_DEPENDS:Q} \ " "${DEPENDS:Q} @@ -91,7 +100,13 @@ _RESOLVE_DEPENDS_CMD= \ # build, full. # _DEPENDS_INSTALL_CMD= \ - case $$type in bootstrap) Type=Bootstrap;; tool) Type=Tool;; build) Type=Build;; full) Type=Full;; esac; \ + case $$type in \ + bootstrap) Type=Bootstrap;; \ + tool) Type=Tool;; \ + build) Type=Build;; \ + test) Type=Test;; \ + full) Type=Full;; \ + esac; \ case $$type in \ bootstrap|tool) \ if expr "${USE_CROSS_COMPILE:Uno}" : '[yY][eE][sS]' >/dev/null; then \ @@ -103,7 +118,7 @@ _DEPENDS_INSTALL_CMD= \ archopt=TARGET_ARCH=${MACHINE_ARCH}; \ pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ ;; \ - build|full) \ + build|test|full) \ extradep=" ${PKGNAME}"; \ cross=${USE_CROSS_COMPILE:Uno}; \ archopt=; \ @@ -126,7 +141,7 @@ _DEPENDS_INSTALL_CMD= \ case $$type in \ bootstrap|tool) \ pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \ - build|full) \ + build|test|full) \ pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \ esac; \ case "$$pkg" in \ @@ -141,7 +156,7 @@ _DEPENDS_INSTALL_CMD= \ case $$type in \ bootstrap|tool) \ objfmt=`${HOST_PKG_INFO} -Q OBJECT_FMT "$$pkg"`;; \ - build|full) \ + build|test|full) \ objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`;; \ esac; \ case "$$objfmt" in \ @@ -235,3 +250,28 @@ _pkgformat-bootstrap-depends: .PHONY: acquire-bootstrap-depends-lock: acquire-lock release-bootstrap-depends-lock: release-lock + +###################################################################### +### test-depends (PUBLIC, pkgsrc/mk/depends/depends.mk) +###################################################################### +### test-depends is a public target to install any missing +### dependencies needed for the "test" stage. +### These dependencies are listed in TEST_DEPENDS. +### +.PHONY: test-depends +_TEST_DEPENDS_TARGETS+= acquire-test-depends-lock +_TEST_DEPENDS_TARGETS+= _pkgformat-test-depends +_TEST_DEPENDS_TARGETS+= release-test-depends-lock + +test-depends: ${_TEST_DEPENDS_TARGETS} + +_pkgformat-test-depends: + ${RUN}${_LIST_DEPENDS_CMD.test} | \ + while read type pattern dir; do \ + ${TEST} "$$type" = "test" || continue; \ + ${_DEPENDS_INSTALL_CMD}; \ + done + +.PHONY: +acquire-test-depends-lock: acquire-lock +release-test-depends-lock: release-lock diff --git a/mk/pkgformat/pkg/list-dependencies b/mk/pkgformat/pkg/list-dependencies index 81b926670f4..b56719932ee 100755 --- a/mk/pkgformat/pkg/list-dependencies +++ b/mk/pkgformat/pkg/list-dependencies @@ -57,12 +57,13 @@ print_entries() { done } -if [ $# != 4 ]; then - echo "usage: list-dependencies bootstrap_depends tool_depends build_depends depends" 1>&2 +if [ $# != 5 ]; then + echo "usage: list-dependencies bootstrap_depends test_depends tool_depends build_depends depends" 1>&2 exit 1 fi print_entries bootstrap "$1" -print_entries tool "$2" -print_entries build "$3" -print_entries full "$4" +print_entries test "$2" +print_entries tool "$3" +print_entries build "$4" +print_entries full "$5" diff --git a/mk/pkgformat/pkg/resolve-dependencies b/mk/pkgformat/pkg/resolve-dependencies index 89296f1e5fa..eeefc584ab7 100755 --- a/mk/pkgformat/pkg/resolve-dependencies +++ b/mk/pkgformat/pkg/resolve-dependencies @@ -40,6 +40,7 @@ find_best() { ${CAT} ${DEPENDS_FILE} | while read type pattern dir; do pkg=`find_best "$type" "$pattern"` + [ "$type" != test ] || continue case "$pkg" in "") error_msg "[resolve-dependencies] A package matching \`\`$pattern'' should" |