pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Introduce TEST_DEPENDS.
details: https://anonhg.NetBSD.org/pkgsrc/rev/7f4d1820b532
branches: trunk
changeset: 373992:7f4d1820b532
user: joerg <joerg%pkgsrc.org@localhost>
date: Sat Jan 13 12:48:56 2018 +0000
description:
Introduce TEST_DEPENDS.
Place them in ALL_DEPENDS iff PKGSRC_RUN_TESTS is set, so that bulk
builds will pick them up.
diffstat:
mk/bsd.pkg.mk | 3 +-
mk/bsd.utils.mk | 5 ++-
mk/build/test.mk | 3 +-
mk/depends/bsd.depends.mk | 4 +-
mk/pkgformat/pkg/depends.mk | 52 ++++++++++++++++++++++++++++++----
mk/pkgformat/pkg/list-dependencies | 11 ++++---
mk/pkgformat/pkg/resolve-dependencies | 1 +
7 files changed, 63 insertions(+), 16 deletions(-)
diffs (229 lines):
diff -r 564b13b91be9 -r 7f4d1820b532 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/bsd.pkg.mk Sat Jan 13 12:48:56 2018 +0000
@@ -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?= pkgsrc-users%NetBSD.org@localhost
.endif
PKGWILDCARD?= ${PKGBASE}-[0-9]*
+TEST_DEPENDS?= # empty
TOOL_DEPENDS?= # empty
.if defined(GITHUB_TAG)
WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}
diff -r 564b13b91be9 -r 7f4d1820b532 mk/bsd.utils.mk
--- a/mk/bsd.utils.mk Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/bsd.utils.mk Sat Jan 13 12:48:56 2018 +0000
@@ -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 -r 564b13b91be9 -r 7f4d1820b532 mk/build/test.mk
--- a/mk/build/test.mk Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/build/test.mk Sat Jan 13 12:48:56 2018 +0000
@@ -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_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 -r 564b13b91be9 -r 7f4d1820b532 mk/depends/bsd.depends.mk
--- a/mk/depends/bsd.depends.mk Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/depends/bsd.depends.mk Sat Jan 13 12:48:56 2018 +0000
@@ -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 @@
# 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 -r 564b13b91be9 -r 7f4d1820b532 mk/pkgformat/pkg/depends.mk
--- a/mk/pkgformat/pkg/depends.mk Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/pkgformat/pkg/depends.mk Sat Jan 13 12:48:56 2018 +0000
@@ -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 @@
_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 @@
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 @@
${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 @@
# 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 @@
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 @@
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 @@
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 @@
.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 -r 564b13b91be9 -r 7f4d1820b532 mk/pkgformat/pkg/list-dependencies
--- a/mk/pkgformat/pkg/list-dependencies Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/pkgformat/pkg/list-dependencies Sat Jan 13 12:48:56 2018 +0000
@@ -57,12 +57,13 @@
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 -r 564b13b91be9 -r 7f4d1820b532 mk/pkgformat/pkg/resolve-dependencies
--- a/mk/pkgformat/pkg/resolve-dependencies Sat Jan 13 09:10:33 2018 +0000
+++ b/mk/pkgformat/pkg/resolve-dependencies Sat Jan 13 12:48:56 2018 +0000
@@ -40,6 +40,7 @@
${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"
Home |
Main Index |
Thread Index |
Old Index