pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/pkgformat/pkg Using script templates implies a depe...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2456eee8d3a1
branches:  trunk
changeset: 363155:2456eee8d3a1
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Jun 02 19:13:44 2017 +0000

description:
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:

 mk/pkgformat/pkg/scripts.mk         |   3 +-
 mk/pkgformat/pkg/tests/scripts_test |  40 ++++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diffs (89 lines):

diff -r b5dfa4a6561f -r 2456eee8d3a1 mk/pkgformat/pkg/scripts.mk
--- a/mk/pkgformat/pkg/scripts.mk       Fri Jun 02 19:13:34 2017 +0000
+++ b/mk/pkgformat/pkg/scripts.mk       Fri Jun 02 19:13:44 2017 +0000
@@ -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 @@
 #
 .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 -r b5dfa4a6561f -r 2456eee8d3a1 mk/pkgformat/pkg/tests/scripts_test
--- a/mk/pkgformat/pkg/tests/scripts_test       Fri Jun 02 19:13:34 2017 +0000
+++ b/mk/pkgformat/pkg/tests/scripts_test       Fri Jun 02 19:13:44 2017 +0000
@@ -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 @@
 }
 
 ###
-### 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 @@
        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
 }



Home | Main Index | Thread Index | Old Index