Module: check_mk
Branch: master
Commit: 71f98efd07190aac04b7519ea51a59a255bd0ce5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71f98efd07190a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 16 08:18:27 2018 +0100
make dist: Cleanup false positive error messages
The excludes for the agent build directories were always applied while
the directories did not exist all the time. This made the tar command
exit with an error exit code (which was printed to the log, but ignored
by the makefile).
For better error handling the script would now fail in such a case. The
tar command has been fixed by making the excludes be applied optionally
only in case the directories in question exist.
Future todo: Make the whole Makefile use stricter shell operation mode.
Change-Id: Ieb3015fa1116990117bb1cc73ceb58da9d916801
---
Makefile | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 2de2ea3..74c12eb 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ DEMO_SUFFIX :=
OMD_VERSION := $(VERSION).$(EDITION_SHORT)$(DEMO_SUFFIX)
SHELL := /bin/bash
+# TODO: Be more strict - Add this:
+#SHELL := /bin/bash -e -o pipefail
NAME := check_mk
PREFIX := /usr
BINDIR := $(PREFIX)/bin
@@ -193,7 +195,7 @@ ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise agents/plugins/cmk-update-agent
$(MAKE) -C enterprise agents/windows/plugins/cmk-update-agent.exe
endif
- @EXCLUDES= ; \
+ @set -e -o pipefail ; EXCLUDES= ; \
if [ -d .git ]; then \
git rev-parse --short HEAD > COMMIT ; \
for X in $$(git ls-files --directory --others -i --exclude-standard) ; do \
@@ -201,6 +203,10 @@ endif
EXCLUDES+=" --exclude $${X%*/}" ; \
fi ; \
done ; \
+ else \
+ for F in $(DIST_ARCHIVE) enterprise/agents/plugins/{build,src}
enterprise/agents/windows/{build64,build}; do \
+ EXCLUDES+=" --exclude $$F" ; \
+ done ; \
fi ; \
if [ -d check-mk-$(EDITION)-$(OMD_VERSION) ]; then \
rm -rf check-mk-$(EDITION)-$(OMD_VERSION) ; \
@@ -213,17 +219,14 @@ endif
--exclude .gitignore \
--exclude .gitmodules \
--exclude .gitattributes \
- --exclude $(DIST_ARCHIVE) \
- --exclude enterprise/agents/plugins/{build,src} \
- --exclude enterprise/agents/windows/{build64,build} \
$$EXCLUDES \
- * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION) ; \
+ * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION)
if [ -f COMMIT ]; then \
rm COMMIT ; \
- fi ; \
+ fi
tar -cz --wildcards -f $(DIST_ARCHIVE) \
$(TAROPTS) \
- check-mk-$(EDITION)-$(OMD_VERSION) ; \
+ check-mk-$(EDITION)-$(OMD_VERSION)
rm -rf check-mk-$(EDITION)-$(OMD_VERSION)
# This tar file is only used by "omd/packages/check_mk/Makefile"