From 9284f1aea31f0eb23e2ea72f7218b271e2234762 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 29 May 2024 16:33:24 +0300 Subject: [PATCH] Build: Update po/*.po files only when needed When po/xz.pot doesn't exist, running "make" or "make dist" will create it. Then the .po files will be updated but only if they actually would change more than the POT-Creation-Date line. Then the .gmo files would be generated from the .po files. This is the case before and after this commit. However, "make dist" and thus "make mydist" did a forced update to the files, updating them even if the only change was the POT-Creation-Date line. This had pros and cons: It made it clear that the .po file really is in sync with the recent strings in the package. On the other hand, it added noise in form of changed files in the source tree and distribution tarballs. It can be ignored with something like "diff -I'^"POT-Creation-Date: '" but it's still a minor annoyance *if* there's not enough value in having the most recent timestamp. Setting DIST_DEPENDS_ON_UPDATE_PO = no means that such forced update won't happen in "make dist" anymore. However, the "mydist" target will use xz.pot-update target which is the same target that is run when xz.pot doesn't exist at all yet. Thus "mydist" will ensure that the translations are up to date, without noise from changes that would affect only the POT-Creation-Date line. Note that po4a always uses msgmerge with --update, so POT-Creation-Date in the man page translations is never the only change in .po files. In that sense this commit makes the message translations behave more similarly to the man page translations. Distribution tarballs will still have non-reproducible POT-Creation-Date in po/xz.pot and po4a/xz-man.pot but those are just two files. Even they could be made reproducible from a Git timestamp if desired. --- Makefile.am | 3 ++- po/Makevars | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 129ecfa8..56f3141d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -92,10 +92,11 @@ dist-hook: cd "$(distdir)" && $(SHELL) "build-aux/license-check.sh" # This works with GNU tar and gives cleaner package than normal 'make dist'. -# This also ensures that the man page translations are up to date (dist-hook +# This also ensures that the translations are up to date (dist-hook # would be too late for that). mydist: $(SHELL) "$(srcdir)/src/liblzma/validate_map.sh" + cd po && $(MAKE) xz.pot-update cd "$(srcdir)/po4a" && $(SHELL) update-po VERSION=$(VERSION); \ if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \ diff --git a/po/Makevars b/po/Makevars index 8f97f7de..91087890 100644 --- a/po/Makevars +++ b/po/Makevars @@ -84,4 +84,8 @@ PO_DEPENDS_ON_POT = yes # regenerate PO files on "make dist". Possible values are "yes" and # "no". Set this to no if the POT file and PO files are maintained # externally. -DIST_DEPENDS_ON_UPDATE_PO = yes +# +# NOTE: The the custom "mydist" target in ../Makefile.am updates xz.pot. +# An updated xz.pot will cause the .po files to be updated too but +# only when updating would change more than the POT-Creation-Date line. +DIST_DEPENDS_ON_UPDATE_PO = no