From: Todd C. Miller Date: Fri, 5 Aug 2011 16:33:40 +0000 (-0400) Subject: Add check for out of date message catalogs when doing "make dist". X-Git-Tag: SUDO_1_8_2~17^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53656020f7be7c11f0e1e11405e9ca5823935d66;p=sudo Add check for out of date message catalogs when doing "make dist". --- diff --git a/Makefile.in b/Makefile.in index adb3863c1..6396758ad 100644 --- a/Makefile.in +++ b/Makefile.in @@ -170,39 +170,59 @@ sync-po: rsync -Lrtvz translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/ update-pot: - @cd $(top_srcdir); \ - for pot in $(POTFILES); do \ - echo "Updating $$pot"; \ - domain=`basename $$pot .pot`; \ - case "$$domain" in \ - sudo) cfiles="src/*c common/*c compat/*c";; \ - sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \ - *) echo unknown domain $$domain; continue;; \ - esac; \ - $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot; \ - done + @if $(XGETTEXT) --help >/dev/null 2>&1; then \ + cd $(top_srcdir); \ + for pot in $(POTFILES); do \ + echo "Updating $$pot"; \ + domain=`basename $$pot .pot`; \ + case "$$domain" in \ + sudo) cfiles="src/*c common/*c compat/*c";; \ + sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \ + *) echo unknown domain $$domain; continue;; \ + esac; \ + $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \ + if diff -I'^.POT-Creation-Date' $$pot.tmp $$pot >/dev/null; then \ + mv -f $$pot.tmp $$pot; \ + else \ + rm -f $$pot.tmp; \ + fi; \ + done; \ + fi update-po: update-pot - @cd $(top_srcdir); \ - for pot in $(POTFILES); do \ - podir=`dirname $$pot`; \ - for po in $$podir/*.po; do \ - echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \ - $(MSGMERGE) --update $$po $$pot; \ - $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \ + @if $(MSGFMT) --help >/dev/null 2>&1; then \ + cd $(top_srcdir); \ + for pot in $(POTFILES); do \ + podir=`dirname $$pot`; \ + for po in $$podir/*.po; do \ + echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \ + $(MSGMERGE) --update $$po $$pot; \ + $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \ + done; \ done; \ - done + fi compile-po: - @cd $(top_srcdir); \ - for pot in $(POTFILES); do \ - podir=`dirname $$pot`; \ - for po in $$podir/*.po; do \ + @if $(MSGFMT) --help >/dev/null 2>&1; then \ + cd $(top_srcdir); \ + rm -f Makefile.$$$$; \ + POFILES=""; \ + for pot in $(POTFILES); do \ + podir=`dirname $$pot`; \ + for po in $$podir/*.po; do \ + POFILES="$$POFILES $$po"; \ + done; \ + done; \ + echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \ + echo "" >> Makefile.$$$$; \ + for po in $$POFILES; do \ mo=`echo $$po | sed 's/po$$/mo/'`; \ - echo $(ECHO_N) "Compiling $$mo: $(ECHO_C)"; \ - $(MSGFMT) --statistics -c -o $$mo $$po; \ + echo "$$mo: $$po" >> Makefile.$$$$; \ + echo " $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \ done; \ - done + make -f Makefile.$$$$; \ + rm -f Makefile.$$$$; \ + fi install-nls: @if test "$(NLS)" = "enabled"; then \ @@ -221,7 +241,15 @@ install-nls: done; \ fi -dist: ChangeLog $(srcdir)/MANIFEST +check-dist: update-pot compile-po + @if [ -d .hg ]; then \ + if hg stat -am | grep '\.[mp]ot*$$'; then \ + echo "Uncommitted message catalog changes" 1>&2; \ + false; \ + fi; \ + fi + +dist: check-dist ChangeLog $(srcdir)/MANIFEST pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \ -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \ `sed 's/[ ].*//' $(srcdir)/MANIFEST`