[Libguestfs] [PATCH] build: improve maintainer-check-extra-dist target

Pino Toscano ptoscano at redhat.com
Tue Sep 8 09:53:43 UTC 2015


Filter out from the git ls-files output the files we don't care they
appeared (gnulib and intltools stuff), and use comm to only show the
remaining added files (i.e. files not being distributed).

The output of comm is redirected to file and then printed, so we can
check it is empty (failing the target if not).
---
 Makefile.am | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8f0bb1b..f4916a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -573,13 +573,15 @@ maintainer-tag:
 maintainer-check-extra-dist:
 	zcat $(PACKAGE_NAME)-$(VERSION).tar.gz | tar tf - | sort | \
 	  sed 's,^$(PACKAGE_NAME)-$(VERSION)/,,' > tmp/tarfiles
-	git ls-files | sort > tmp/gitfiles
-	diff -ur tmp/tarfiles tmp/gitfiles | \
-	  grep '^\+' | \
-	  grep -v '^\+intltool-.*\.in' | \
-	  grep -v '^\+.gitmodules' | \
-	  grep -v '^\+.gnulib' ||:
-	rm tmp/tarfiles tmp/gitfiles
+	git ls-files | \
+	  grep -v '^intltool-.*\.in' | \
+	  grep -v '^\.gitmodules' | \
+	  grep -v '^\.gnulib' | \
+	  sort > tmp/gitfiles
+	comm -13 tmp/tarfiles tmp/gitfiles > tmp/comm-out
+	cat tmp/comm-out
+	[ ! -s tmp/comm-out ]
+	rm tmp/tarfiles tmp/gitfiles tmp/comm-out
 
 # Provide help on common Makefile targets.
 
-- 
2.1.0




More information about the Libguestfs mailing list