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.

--
John Dennis <jden...@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
>From 324734f811ef0a67a590282393b0ebb52927a35d Mon Sep 17 00:00:00 2001
From: John Dennis <jden...@redhat.com>
Date: Sat, 20 Feb 2010 11:00:01 -0500
Subject: [PATCH] make update-pot will not touch pot file if msgid's are unmodified
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

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.
---
 install/po/Makefile.in |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/install/po/Makefile.in b/install/po/Makefile.in
index ac3ab64..94f6848 100644
--- a/install/po/Makefile.in
+++ b/install/po/Makefile.in
@@ -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 "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 "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
 
-- 
1.6.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to