]> granicus.if.org Git - sudo/commitdiff
Add check for out of date message catalogs when doing "make dist".
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 5 Aug 2011 16:33:40 +0000 (12:33 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 5 Aug 2011 16:33:40 +0000 (12:33 -0400)
Makefile.in

index adb3863c1a94994972b5bae3ee80859c8df66d93..6396758ad414f6dc985ad80af0fe34c4df6cbfb9 100644 (file)
@@ -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`