Oh shell-fu, don't leave me now.

In data/, check for any svg files that are listed as Layout but don't exist.
In data/layout, check for any existing file that's not listed in the tablet
files.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 configure.ac             |  2 ++
 data/Makefile.am         | 12 +++++++++++-
 data/layouts/Makefile.am | 10 +++++++++-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 520ae5e..291cabe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,8 @@ AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_INSTALL
 PKG_PROG_PKG_CONFIG
+AC_PATH_PROG(SED, sed)
+AC_PATH_PROG(GREP, grep)
 
 AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])
 AM_CONDITIONAL(HAVE_DOXYGEN, test "x$HAVE_DOXYGEN" = xyes)
diff --git a/data/Makefile.am b/data/Makefile.am
index 62b4e1d..dc39076 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,6 @@
 libwacomtabletdir = $(datadir)/libwacom
-dist_libwacomtablet_DATA =  $(shell find $(top_srcdir)/data -name "*.tablet" 
-printf "%P\n")
+tablet_files = $(shell find $(top_srcdir)/data -name "*.tablet" -printf "%P\n")
+dist_libwacomtablet_DATA =  $(tablet_files)
 
 libwacomstylusdir = $(datadir)/libwacom
 dist_libwacomstylus_DATA =  $(shell find $(top_srcdir)/data -name "*.stylus" 
-printf "%P\n")
@@ -7,3 +8,12 @@ dist_libwacomstylus_DATA =  $(shell find $(top_srcdir)/data 
-name "*.stylus" -pr
 EXTRA_DIST = wacom.example
 
 SUBDIRS = layouts
+
+check:
+       @for file in $(tablet_files); do \
+               svg=`$(GREP) 'Layout=' "$(top_srcdir)/data/$$file" | $(SED) -e 
"s/Layout=//"`; \
+               test -z "$$svg" || \
+               test -e "$(top_srcdir)/data/layouts/$$svg" || ( \
+                       echo "ERROR: File $$file references nonexistent $$svg" 
&& test); \
+               rc="$$(($$rc + $$?))"; \
+       done && test 0 -eq $$rc
diff --git a/data/layouts/Makefile.am b/data/layouts/Makefile.am
index 06487f5..d258a3e 100644
--- a/data/layouts/Makefile.am
+++ b/data/layouts/Makefile.am
@@ -1,4 +1,12 @@
 libwacomlayoutsdir = $(datadir)/libwacom/layouts
-dist_libwacomlayouts_DATA =  $(shell find $(top_srcdir)/data/layouts -name 
"*.svg" -printf "%P\n")
+layouts = $(shell find $(top_srcdir)/data/layouts -name "*.svg" -printf "%P\n")
+dist_libwacomlayouts_DATA =  $(layouts)
 
 EXTRA_DIST = README
+
+check:
+       @for file in $(layouts); do \
+               $(GREP) -q "$$file" $(top_srcdir)/data/*.tablet || (\
+                       echo "ERROR: Layout $$file is not referenced" && test); 
\
+               rc="$$(($$rc + $$?))"; \
+       done && test 0 -eq $$rc
-- 
2.7.4


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to