From 53d499e549e6eec5e319965cf2df1368120f2bca Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 30 Jul 2018 07:11:29 +0100 Subject: [PATCH] i18n: Copy po/Makefile and remove-potcdate.plfrom debconf These are from debconf.git a326240dd50487732d8546858994d48b45bf0b20. There doesn't seem to be a common library for this kind of thing. I'm going to take debconf as a good example and nick the code. Copyright: the debian/copyright file of debconf says it's BSD-2-clause. So add that, and copyright notices based on "git log" (which does seem comprehensive). Signed-off-by: Ian Jackson --- debian/copyright | 28 ++++++++++++++++++++++++ po/Makefile | 50 +++++++++++++++++++++++++++++++++++++++++++ po/remove-potcdate.pl | 11 ++++++++++ 3 files changed, 89 insertions(+) create mode 100644 po/Makefile create mode 100755 po/remove-potcdate.pl diff --git a/debian/copyright b/debian/copyright index c5b10a15..f5c879d9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,6 +3,9 @@ Integration between git and Debian-style archives Copyright (C)2013-2018 Ian Jackson Copyright (C)2016-2018 Sean Whitton +Copyright (C)1999-2010 Joey Hess +Copyright (C)2004-2010 Colin Watson + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +27,31 @@ Debian metadata, by Bill Alombert, with a licence statement saying it's GPL (implicitly GPLv3 compatible). +Some of the i18n build system was copied from the Debian debconf +package, which has the BSD-2-clause (GPLv3-compatible) licence: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + + Contributions are accepted upstram under the same terms; please sign off your patches (by writing an approprite Signed-Off-By tag in your commit message or patch submission) to indicate your attestation that diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 00000000..e5b4bc84 --- /dev/null +++ b/po/Makefile @@ -0,0 +1,50 @@ +# List here all source files with translatable strings. +POTFILES=$(sort $(shell find ../Debconf -type f -name \*.pm)) \ + ../dpkg-* ../debconf-* ../debconf + +POFILES=$(wildcard *.po) +MOFILES=$(POFILES:.po=.mo) + +all: debconf.pot $(MOFILES) + +install: all + for file in $(MOFILES); do \ + lang=`echo $$file | sed 's/\.mo//'`; \ + install -d $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/; \ + install -m 0644 $$file $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/debconf.mo; \ + done + +debconf.pot: $(POTFILES) + @echo "Rebuilding the pot file" + TZ=UTC xgettext $(POTFILES) -o debconf.pot.new -Lperl + if [ -f debconf.pot ]; then \ + ./remove-potcdate.pl < debconf.pot > debconf.1po && \ + ./remove-potcdate.pl < debconf.pot.new > debconf.2po && \ + if cmp debconf.1po debconf.2po >/dev/null 2>&1; then \ + rm -f debconf.1po debconf.2po debconf.pot.new; \ + else \ + rm -f debconf.1po debconf.2po && \ + mv debconf.pot.new debconf.pot; \ + fi; \ + else \ + mv debconf.pot.new debconf.pot; \ + fi + +clean: + rm -f $(MOFILES) debconf.pot.new messages messages.mo + +%.mo: %.po + msgfmt -o $@ $< + +%.po: debconf.pot + @echo -n "Merging debconf.pot and $@" + @msgmerge --previous $@ debconf.pot -o $@.new + @mv -f $@.new $@ + @msgfmt --statistics $@ + +check: + @for file in $(POFILES); do \ + lang=`echo $$file | sed 's/\.po//'`; \ + printf "$$lang: "; \ + msgfmt -o /dev/null -c -v --statistics $$lang.po;\ + done diff --git a/po/remove-potcdate.pl b/po/remove-potcdate.pl new file mode 100755 index 00000000..069a1deb --- /dev/null +++ b/po/remove-potcdate.pl @@ -0,0 +1,11 @@ +#! /usr/bin/perl -n + +BEGIN { + $seen_potcdate = 0; +} + +if (not $seen_potcdate and /^"POT-Creation-Date: .*"/) { + $seen_potcdate = 1; + next; +} +print; -- 2.30.2