make update-pot will not touch pot file if msgid's are unmodified

Formerly running 'make update-pot' would write an insignificantly
different pot file even if the msgid's xgettext found were unmodfied.
Now the result of running xgettext is compared to the existing
pot file after adjusting for things like timestamps, and only
copies the result of xgettext to the new pot file if there
were differences.

This will help eliminate git commits on the pot file if all one
did was see if the pot file was up to date, if it was up to date
git won't see any modifications. It used to be that timestamps
would be different in the pot file just by virtue of checking
if the pot file was current.

fix exit status; replace POT with $(DOMAN).pot
This commit is contained in:
John Dennis
2010-02-22 16:38:56 -05:00
committed by Rob Crittenden
parent 23ac2c31e7
commit 2d3d093d4f
+16 -9
View File
@@ -193,8 +193,8 @@ update-po: update-pot
$(MAKE) all
update-pot:
rm -f $(DOMAIN).pot.update
$(XGETTEXT) $(XGETTEXT_OPTIONS) \
@rm -f $(DOMAIN).pot.update
@$(XGETTEXT) $(XGETTEXT_OPTIONS) \
--output $(DOMAIN).pot.update \
--language="python" \
$(PYTHON_POTFILES) \
@@ -203,13 +203,19 @@ update-pot:
--output $(DOMAIN).pot.update \
--join-existing \
--language="c" \
$(C_POTFILES) \
&& \
mv $(DOMAIN).pot.update $(DOMAIN).pot \
&& \
# Replace the charset with UTF-8 ; \
$(SED) -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot
$(C_POTFILES) ; \
$(SED) '/^"POT-Creation-Date: .*"$$/d' $(DOMAIN).pot.update > $(DOMAIN).pot.update.tmp ; \
$(SED) -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot.update.tmp ; \
$(SED) '/^"POT-Creation-Date: .*"$$/d' $(DOMAIN).pot > $(DOMAIN).pot.tmp ; \
if ! cmp -s $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp ; then \
echo "$(DOMAIN).pot updated" ; \
mv $(DOMAIN).pot.update $(DOMAIN).pot ; \
# Replace the charset with UTF-8 ; \
$(SED) -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot ; \
else \
echo "$(DOMAIN).pot unmodified" ; \
fi || :
@rm -f $(DOMAIN).pot.update $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp
msg-stats:
@pot_count=`$(MSGFMT) --statistics $(DOMAIN).pot 2>&1 | \
@@ -238,6 +244,7 @@ install: $(mo_files)
mostlyclean:
rm -rf *.mo test.po test_locale
rm -f $(DOMAIN).pot.update $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp
clean: mostlyclean