Added make check support which checks syntax of uncommited .pp files.

This commit is contained in:
Timo Mkinen 2010-10-14 10:59:43 +03:00
parent 19b06696e7
commit e35dcb9de9

View file

@ -6,3 +6,15 @@ all: puppet-modules.tar.gz
puppet-modules.tar.gz: $(MODULES)
umask 022 ; tar zcvf $@ --owner=root --group=root \
--mode g-w,o=g --exclude=.git $^
check:
@which puppet > /dev/null 2>&1 || ( \
echo "puppet not installed, cannot perform syntax checking" \
1>&2 ; exit 1 )
@for name in `git diff --name-only`; do \
echo $${name} | egrep '\.pp$$' > /dev/null || continue ; \
errors="`puppet --color=false --parseonly --ignoreimport $${name}`" ; \
[ $$? -eq 0 ] && continue ; \
echo "syntax check failed on $${name}" 1>&2 ; \
echo " $${errors}" 1>&2 ; \
done