[Pkg-isocodes-devel] [iso-codes] 03/05: Do not compare the creation date header for POT files

Tobias Quathamer toddy at moszumanska.debian.org
Sat Mar 26 14:06:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

toddy pushed a commit to branch master
in repository iso-codes.

commit e5086bcfe5dc89487bec16c98d938745e0ff2920
Author: Dr. Tobias Quathamer <toddy at debian.org>
Date:   Sat Mar 26 14:11:09 2016 +0100

    Do not compare the creation date header for POT files
---
 bin/remove-potcdate.sin | 19 +++++++++++++++++++
 common.mk               | 11 ++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/bin/remove-potcdate.sin b/bin/remove-potcdate.sin
new file mode 100644
index 0000000..2436c49
--- /dev/null
+++ b/bin/remove-potcdate.sin
@@ -0,0 +1,19 @@
+# Sed script that remove the POT-Creation-Date line in the header entry
+# from a POT file.
+#
+# The distinction between the first and the following occurrences of the
+# pattern is achieved by looking at the hold space.
+/^"POT-Creation-Date: .*"$/{
+x
+# Test if the hold space is empty.
+s/P/P/
+ta
+# Yes it was empty. First occurrence. Remove the line.
+g
+d
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/common.mk b/common.mk
index fa4c426..2ab811d 100644
--- a/common.mk
+++ b/common.mk
@@ -20,8 +20,17 @@ MOSTLYCLEANFILES = \
 	$(MSGFMT) $(MSGFMT_FLAGS) -o $@ $<
 
 # Generic target to create .pot files from JSON data files
-$(DOMAIN).pot: $(top_srcdir)/bin/pot_from_json.py $(top_srcdir)/data/$(DOMAIN).json
+$(DOMAIN).pot: $(top_srcdir)/bin/pot_from_json.py $(top_srcdir)/data/$(DOMAIN).json $(top_srcdir)/bin/remove-potcdate.sin
+	cp $@ backup.pot
 	python3 $(top_srcdir)/bin/pot_from_json.py $(DOMAIN) $(top_srcdir)/data
+	sed -f $(top_srcdir)/bin/remove-potcdate.sin < $@ > $(DOMAIN).1po
+	sed -f $(top_srcdir)/bin/remove-potcdate.sin < backup.pot > $(DOMAIN).2po
+	if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+		rm -f $(DOMAIN).1po $(DOMAIN).2po $@ && \
+		mv backup.pot $@; \
+	else \
+		rm -f $(DOMAIN).1po $(DOMAIN).2po backup.pot; \
+	fi
 
 # Generic target to create deprecated .xml files from JSON data files
 $(DOMAIN).xml: $(top_srcdir)/bin/xml_from_json.py $(top_srcdir)/data/$(DOMAIN).json

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-isocodes/iso-codes.git



More information about the Pkg-isocodes-devel mailing list