[Kimchi-devel] [PATCH] [Kimchi 1/2] Makefile.am targets enhancements

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Wed Jan 27 18:50:08 UTC 2016


From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>

- check-local: Added '.git' dir check in pyflakes to avoid an
error/warning when running check-local in a git submodule
tree. Added whitespace check too.

- ChangeLog and VERSION: these targets will now run properly
when running in a git submodule tree.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 Makefile.am  | 24 ++++++++++++++++++------
 configure.ac |  3 ++-
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index da3a660..8ee88f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,13 +59,25 @@ I18N_FILES = ./i18n.py \
 
 check-local:
 	contrib/check_i18n.py $(I18N_FILES)
-	find . -path './.git' -prune -type f -o \
-		-name '*.py' -o -name '*.py.in'  | xargs $(PYFLAKES) | \
-		while read LINE; do echo "$$LINE"; false; done
-
+	@if [ -d '.git' ]; then                                        \
+		find . -path './.git' -prune -o                        \
+			-name '*.py' -o -name '*.py.in'  |             \
+			xargs $(PYFLAKES) |                            \
+			while read LINE; do echo "$$LINE"; false; done \
+	else                                                           \
+		find . -name '*.py' -o -name '*.py.in'  |              \
+			xargs $(PYFLAKES) |                            \
+			while read LINE; do echo "$$LINE"; false; done \
+	fi
 	$(PEP8) --version
 	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
 	./check_ui_code_errors.sh
+	@if $(GIT) rev-parse &> /dev/null ; then                         \
+		echo "Whitespace verification ...";                      \
+		git grep --cached -Il '' | grep -v '^ui/spice-html5/' |  \
+			xargs egrep '.* +$$'                             \
+			&& echo "ERROR: Whitespaces found" || echo "Ok"; \
+	fi
 
 # Link built mo files in the source tree to enable use of translations from
 # within the source tree
@@ -132,7 +144,7 @@ suse-rpm: contrib/kimchi.spec.suse
 	$(MAKE) rpm
 
 ChangeLog:
-	@if test -d .git; then                                   \
+	@if $(GIT) rev-parse &> /dev/null ; then                     \
 		$(top_srcdir)/build-aux/genChangelog --release > $@; \
 	fi
 
@@ -160,7 +172,7 @@ uninstall-local:
 	$(RM) -rf $(DESTDIR)/$(localstatedir)/lib/kimchi
 
 VERSION:
-	@if test -d .git; then                                \
+	@if $(GIT) rev-parse &> /dev/null ; then                  \
 		git describe --abbrev=0 --always > $@;            \
 	fi
 
diff --git a/configure.ac b/configure.ac
index 3d698bb..57737a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 #
 # Kimchi
 #
-# Copyright IBM Corp, 2013-2015
+# Copyright IBM Corp, 2013-2016
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -35,6 +35,7 @@ AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([-Wno-portability])
 AM_PATH_PYTHON([2.6])
 AC_PATH_PROG([PEP8], [pep8], [/usr/bin/pep8])
+AC_PATH_PROG([GIT], [git], [/usr/bin/git])
 AC_PYTHON_MODULE([unittest])
 AC_SUBST([HAVE_PYMOD_UNITTEST])
 AC_SUBST([PYTHON_VERSION])
-- 
2.5.0




More information about the Kimchi-devel mailing list