diff options
author | jlam <jlam@pkgsrc.org> | 2017-06-02 19:13:44 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2017-06-02 19:13:44 +0000 |
commit | 0efae112519d733e8a1e75658150c78c00496c68 (patch) | |
tree | 40e8473ee0e2f9cae2fba6d1777ddc50b6714c60 /mk/pkgformat | |
parent | 992e5debf9edcae6236ea9e986dcb64070b195a1 (diff) | |
download | pkgsrc-0efae112519d733e8a1e75658150c78c00496c68.tar.gz |
Using script templates implies a dependency on pkgtasks.
The header template loads pkgtasks' load.subr unconditionally, so
if any script templates are used, then they imply a dependency on
pkgtasks. Trigger the dependency in the "pkgtasks" framework by
setting USE_PKGTASKS to "yes".
Diffstat (limited to 'mk/pkgformat')
-rw-r--r-- | mk/pkgformat/pkg/scripts.mk | 3 | ||||
-rwxr-xr-x | mk/pkgformat/pkg/tests/scripts_test | 40 |
2 files changed, 39 insertions, 4 deletions
diff --git a/mk/pkgformat/pkg/scripts.mk b/mk/pkgformat/pkg/scripts.mk index e0407078035..939a865b6aa 100644 --- a/mk/pkgformat/pkg/scripts.mk +++ b/mk/pkgformat/pkg/scripts.mk @@ -1,4 +1,4 @@ -# $NetBSD: scripts.mk,v 1.1 2017/06/01 02:09:43 jlam Exp $ +# $NetBSD: scripts.mk,v 1.2 2017/06/02 19:13:44 jlam Exp $ # # Copyright (c) 2017 The NetBSD Foundation, Inc. # All rights reserved. @@ -81,6 +81,7 @@ _FOOTER_TMPL?= ${PKGSRCDIR}/mk/pkgformat/pkg/templates/footer # .if ( "${USE_PKGTASKS:tl}" == "yes" ) || !empty(HEADER_TEMPLATES) || \ !empty(DEINSTALL_TEMPLATES) || !empty(INSTALL_TEMPLATES) +USE_PKGTASKS= yes # script templates use pkgtasks DEINSTALL_SRC?= ${_HEADER_TMPL} ${HEADER_TEMPLATES} \ ${DEINSTALL_TEMPLATES} ${_DEINSTALL_TMPL} \ ${_FOOTER_TMPL} ${PKGTASKS_DATAFILE} diff --git a/mk/pkgformat/pkg/tests/scripts_test b/mk/pkgformat/pkg/tests/scripts_test index c160dbfbbfb..4a8e9bf80d6 100755 --- a/mk/pkgformat/pkg/tests/scripts_test +++ b/mk/pkgformat/pkg/tests/scripts_test @@ -1,6 +1,6 @@ #!/usr/bin/env atf-sh # -# $NetBSD: scripts_test,v 1.1 2017/06/01 02:09:43 jlam Exp $ +# $NetBSD: scripts_test,v 1.2 2017/06/02 19:13:44 jlam Exp $ # # Copyright (c) 2017 The NetBSD Foundation, Inc. # All rights reserved. @@ -181,14 +181,14 @@ EOF } ### -### test3: DEINSTALL_SRC and INSTALL_SRC +### test3: set DEINSTALL_SRC and INSTALL_SRC ### atf_test_case test3 test3_head() { - atf_set "descr" "DEINSTALL_SRC and INSTALL_SRC" + atf_set "descr" "set DEINSTALL_SRC and INSTALL_SRC" } test3_body() @@ -226,9 +226,43 @@ EOF atf_pass } +### +### test4 +### + +atf_test_case test4 + +test4_head() +{ + atf_set "descr" "*_TEMPLATES trigger USE_PKGTASKS" +} + +test4_body() +{ + : ${MAKE:=make} + : ${PKGSRCDIR:=/usr/pkgsrc} + + setup + cat > Makefile << 'EOF' +.include "mk.conf" + +INSTALL_TEMPLATES+= fragment.tmpl + +.include "${PKGSRCDIR}/mk/pkgformat/pkg/scripts.mk" + +.PHONY: all +all: + @echo ${USE_PKGTASKS:Q} +EOF + ${MAKE} all PKGSRCDIR="${PKGSRCDIR}" > output + grep "yes" output || atf_fail "USE_PKGTASKS is not yes" + atf_pass +} + atf_init_test_cases() { atf_add_test_case test1 atf_add_test_case test2 atf_add_test_case test3 + atf_add_test_case test4 } |