From 7ee0da3eaffd337b92b898e535e94769eccfa60a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 29 Sep 2022 11:21:55 +0200 Subject: [PATCH] build: don't "update-po" during make dist Instead, hack gettext's Makefile. gettext has an issue with parallel make. See [1] and [2]. Reproduce with: git reset --hard && git clean -fdx && NOCONFIGURE=yes ./autogen.sh && ./configure --enable-gtk-doc --enable-introspection && make -j distcheck V=1 We worked around this by setting "DIST_DEPENDS_ON_UPDATE_PO = yes", however that (obviously) results in regenerating source files during dist. "Source files" in the sense that the po files are commited to git and get distributed in the release. Doing this is very ugly. In particular it's ugly, because `make -C po update-po` is not reproducible and the output depends on the current time (*had one job*). Otherwise, we could just regenerate the files before doing a release. This means, running "release.sh" script ends up with a dirty tree afterwards. Also, the distributed po files are not the ones from the source tree when we did the release. Also, since "release.sh rc1" does two distributions (once for the rc1 and once for the next devel snapshot), the commit for the second distribution will have a large diff for the po files. This reverts commit 978d8eb69923 ('po: make dist depend on update-po') and hacks around the problem. [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1094#note_1435313 [2] https://lists.gnu.org/archive/html/bug-gettext/2022-06/msg00022.html https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1405 --- .gitlab-ci/run-test.sh | 3 --- Makefile.am | 16 ++++++++++++++++ po/Makevars | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci/run-test.sh b/.gitlab-ci/run-test.sh index 5b3f18f0f..1fdb214b8 100755 --- a/.gitlab-ci/run-test.sh +++ b/.gitlab-ci/run-test.sh @@ -20,9 +20,6 @@ fi do_clean() { git clean -fdx - # "make -C update-po", run on "make dist" has a silly habit of - # modifying files in-tree. Lets undo that. - git checkout -- po/ git status git diff --exit-code diff --git a/Makefile.am b/Makefile.am index 58c99be08..6b9b82876 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,6 +168,22 @@ if !BUILD_DOCS dist_configure_check += dist-configure-check endif +# Gettext's Makefile has a race with parallel builds during dist. +# Hack around that. +# See also: +# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1094#note_1435313 +# https://lists.gnu.org/archive/html/bug-gettext/2022-06/msg00022.html +# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1405 +po/.Makefile.patched: + sed -i \ + 's#^dist2: \$$(srcdir)/stamp-po \$$(DISTFILES)#dist2: \$$(srcdir)/stamp-po\n\t\$$(MAKE) \$$(DISTFILES)#' \ + "$(builddir)/po/Makefile" && \ + touch "$(builddir)/po/.Makefile.patched" + +DISTCLEANFILES += po/.Makefile.patched + +dist: po/.Makefile.patched + dist: $(dist_configure_check) $(dist_dependencies) ############################################################################### diff --git a/po/Makevars b/po/Makevars index ebd690f6b..b858b6db7 100644 --- a/po/Makevars +++ b/po/Makevars @@ -75,4 +75,4 @@ PO_DEPENDS_ON_POT = no # 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 +DIST_DEPENDS_ON_UPDATE_PO = no