On tor, 2011-02-10 at 12:58 +0200, Peter Eisentraut wrote:
> There is make check target in doc/src/sgml/ that is supposed to catch
> this.  But it's probably hard to remember to run that.
> 
> One thing I was thinking of was that we could add a global make
> maintainer-check target (a name I picked up from other projects) which
> would run various source code sanity checks.  Besides the SGML tabs
> issue, my favourite would be duplicate_oids.  Maybe if we could find a
> third use case, we'd have a quorum for implementing this.

Hah, I found one.  There's already a hidden maintainer-check target that
checks the NLS files syntax.

Anyway, here is a small patch that changes the duplicate_oids script to
return a nonzero exit status in case of a problem, and then creates a
global maintainer-check target that checks that and the SGML syntax and
the NLS thing.  Other things could be added in the future.
Documentation should be added.

Useful?

diff --git a/GNUmakefile.in b/GNUmakefile.in
index b9c5f31..f3c5fe5 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -65,6 +65,8 @@ $(call recurse,check-world,src/test src/pl src/interfaces/ecpg,check)
 
 $(call recurse,installcheck-world,src/test src/pl src/interfaces/ecpg contrib,installcheck)
 
+$(call recurse,maintainer-check,doc src config contrib)
+
 GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
 	./config.status $@
 
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index add2c28..3041a53 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -279,7 +279,7 @@ MAKEINFO = makeinfo
 ##
 
 # Quick syntax check without style processing
-check: postgres.sgml $(ALMOSTALLSGML) check-tabs
+check maintainer-check: postgres.sgml $(ALMOSTALLSGML) check-tabs
 	$(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
 
 
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 2eff4d4..69512ac 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -18,9 +18,9 @@
 #
 # Meta configuration
 
-standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck
+standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck maintainer-check
 
-.PHONY: $(standard_targets) install-strip maintainer-check html man installcheck-parallel
+.PHONY: $(standard_targets) install-strip html man installcheck-parallel
 
 # make `all' the default target
 all:
diff --git a/src/include/Makefile b/src/include/Makefile
index 0d5f049..1bfb4a7 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -67,3 +67,6 @@ clean:
 
 distclean maintainer-clean: clean
 	rm -f pg_config.h dynloader.h pg_config_os.h stamp-h
+
+maintainer-check:
+	cd catalog && ./duplicate_oids
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index 3f3d9f6..82c12f3 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -22,6 +22,9 @@ sed -n	-e 's/^DATA(insert *OID *= *\([0-9][0-9]*\).*$/\1/p' \
 	-e 's/^DECLARE_TOAST([^,]*, *\([0-9][0-9]*\), *\([0-9][0-9]*\).*$/\1,\2/p' | \
 tr ',' '\n' | \
 sort -n | \
-uniq -d
+uniq -d | \
+grep '.'
 
-exit 0
+# nonzero exit code if lines were produced
+[ $? -eq 1 ]
+exit
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to