summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorcheusov <cheusov>2014-01-14 10:52:12 +0000
committercheusov <cheusov>2014-01-14 10:52:12 +0000
commitd8079afbb7fe665b7d8c63435a38cd4cc6724c84 (patch)
treef0e74c991eac6fa393e7493a216693ad8fb98e74 /mk
parentfa4a31bd943e73521ff0093541b28f031552403f (diff)
downloadpkgsrc-d8079afbb7fe665b7d8c63435a38cd4cc6724c84.tar.gz
New private target sanity-check-depends for checking DEPENDS,
BUILD_DEPENDS, TOOL_DEPENDS and CONFLICTS for correctness (>x.y.* like patterns). This check is run in the beginning of "depend" target.
Diffstat (limited to 'mk')
-rw-r--r--mk/depends/depends.mk26
1 files changed, 25 insertions, 1 deletions
diff --git a/mk/depends/depends.mk b/mk/depends/depends.mk
index 6bf5e4c4ba1..c3eb73fa0e0 100644
--- a/mk/depends/depends.mk
+++ b/mk/depends/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.16 2011/10/15 00:23:08 reed Exp $
+# $NetBSD: depends.mk,v 1.17 2014/01/14 10:52:12 cheusov Exp $
######################################################################
### depends (PUBLIC)
@@ -6,6 +6,7 @@
### depends is a public target to install missing dependencies for
### the package.
###
+_DEPENDS_TARGETS+= sanity-check-depends
_DEPENDS_TARGETS+= acquire-depends-lock
_DEPENDS_TARGETS+= ${_COOKIE.depends}
_DEPENDS_TARGETS+= release-depends-lock
@@ -62,3 +63,26 @@ depends-message:
.PHONY: pre-depends-hook
pre-depends-hook:
@${DO_NADA}
+
+######################################################################
+### sanity-check-depends (PRIVATE)
+######################################################################
+### sanity-check-depends is a private target to check that DEPENDS,
+### TOOL_DEPENDS, BUILD_DEPENDS and CONFLICTS contain correct values
+###
+
+_SANITY_CHECK_DEPENDS_CMD=${AWK} ' \
+ match($$1, /[<>][^,{}]*[*?\[\]]/) { \
+ sub(/:[^{}]*$$/, "", $$1); \
+ print "Incorrect dependency: " $$1; \
+ ex=1 \
+ } \
+ END { exit ex }'
+
+.PHONY: sanity-check-depends
+sanity-check-depends:
+ @{ ${DEPENDS:@.temp.@echo '${.temp.}';@} \
+ ${BUILD_DEPENDS:@.temp.@echo '${.temp.}';@} \
+ ${TOOL_DEPENDS:@.temp.@echo '${.temp.}';@} \
+ ${CONFLICTS:@.temp.@echo '${.temp.}';@} \
+ } | ${_SANITY_CHECK_DEPENDS_CMD}