pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/pkgtasks Be more flexible about adding dependency o...



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

description:
Be more flexible about adding dependency on pkgtasks.

Check the value of ${USE_PKGTASKS} at the time of reference for
the DEPENDS variable to see whether "pkgtasks" needs to be added
or not.

diffstat:

 mk/pkgtasks/bsd.pkgtasks.mk     |   7 +++----
 mk/pkgtasks/tests/pkgtasks_test |  31 +++++++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 6 deletions(-)

diffs (74 lines):

diff -r 31b29c6eae90 -r b5dfa4a6561f mk/pkgtasks/bsd.pkgtasks.mk
--- a/mk/pkgtasks/bsd.pkgtasks.mk       Fri Jun 02 19:13:26 2017 +0000
+++ b/mk/pkgtasks/bsd.pkgtasks.mk       Fri Jun 02 19:13:34 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkgtasks.mk,v 1.2 2017/06/02 19:13:26 jlam Exp $
+# $NetBSD: bsd.pkgtasks.mk,v 1.3 2017/06/02 19:13:34 jlam Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -142,9 +142,8 @@
 .include "${PKGSRCDIR}/mk/pkgtasks/usergroup.mk"
 
 # Add a dependency on pkgtasks if package tasks are needed.
-.if "${USE_PKGTASKS:tl}" == "yes"
-DEPENDS+=              pkgtasks-1>=1.9:../../pkgtools/pkgtasks
-.endif
+_PKGTASKS_DEPENDS=     pkgtasks-1>=1.9:../../pkgtools/pkgtasks
+DEPENDS+=              ${"${USE_PKGTASKS:tl}" == "yes":?${_PKGTASKS_DEPENDS}:}
 TASK_MODULE_DIR?=      ${LOCALBASE}/share/pkgtasks-1
 
 # PKGTASKS_DATAFILE
diff -r 31b29c6eae90 -r b5dfa4a6561f mk/pkgtasks/tests/pkgtasks_test
--- a/mk/pkgtasks/tests/pkgtasks_test   Fri Jun 02 19:13:26 2017 +0000
+++ b/mk/pkgtasks/tests/pkgtasks_test   Fri Jun 02 19:13:34 2017 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/env atf-sh
 #
-# $NetBSD: pkgtasks_test,v 1.2 2017/06/02 16:12:26 jlam Exp $
+# $NetBSD: pkgtasks_test,v 1.3 2017/06/02 19:13:34 jlam Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -128,13 +128,40 @@
        ${MAKE} depends PKGSRCDIR="${PKGSRCDIR}" > output
        
        cat output
-       grep -q "pkgtools/pkgtasks" output ||
+       grep "pkgtools/pkgtasks" output ||
        atf_fail "pkgtasks dependency missing"
        atf_pass
 }
 
+###
+### test3
+###
+
+atf_test_case test3
+
+test3_head()
+{
+       atf_set "descr" "no pkgtasks dependency"
+}
+
+test3_body()
+{
+       : ${MAKE:=make}
+       : ${PKGSRCDIR:=/usr/pkgsrc}
+
+       setup
+
+       ${MAKE} depends PKGSRCDIR="${PKGSRCDIR}" > output
+
+       cat output
+       grep "pkgtools/pkgtasks" output &&
+       atf_fail "pkgtasks dependency present"
+       atf_pass
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case test1
        atf_add_test_case test2
+       atf_add_test_case test3
 }



Home | Main Index | Thread Index | Old Index