[gimp] Issue #7907: work around possible outdated data in meson tarball.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #7907: work around possible outdated data in meson tarball.
- Date: Tue, 2 Aug 2022 14:08:44 +0000 (UTC)
commit ef85c51a58174923d1f0f66659b595380262d4fd
Author: Jehan <jehan girinstud io>
Date: Tue Aug 2 15:21:55 2022 +0200
Issue #7907: work around possible outdated data in meson tarball.
`meson dist` don't imply a reconfigure or a rebuild which is actually
not great as it means a wrong order of commands may create tarballs with
outdated data (typically: build, then pull new code, then dist).
Of course for our official tarballs, it should be fine as we don't
generate tarballs manually anymore, but through the CI. Yet, just to be
on the safe side, force-trigger a reconfigure then a build (which would
likely be very fast anyway in the common use case where we just did a
build right before).
Additionally the INSTALL.in file is not copied anymore in the tarball
and INSTALL will only be generated in git repositories.
meson.build | 17 +++++++++++------
meson_dist_script.sh | 33 +++++++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 8 deletions(-)
---
diff --git a/meson.build b/meson.build
index a8be6c2e17..a66693f52e 100644
--- a/meson.build
+++ b/meson.build
@@ -1557,11 +1557,14 @@ install_conf.set('WEBP_REQUIRED_VERSION', webp_minver)
install_conf.set('WMF_REQUIRED_VERSION', wmf_minver)
install_conf.set('XGETTEXT_REQUIRED_VERSION', '0.19')
-INSTALL = configure_file(
- input : 'INSTALL.in',
- output: 'INSTALL',
- configuration: install_conf
-)
+if is_git_repository
+ # Tarballs won't have INSTALL.in, only the generated INSTALL.
+ INSTALL = configure_file(
+ input : 'INSTALL.in',
+ output: 'INSTALL',
+ configuration: install_conf
+ )
+endif
configure_file(
@@ -1635,7 +1638,9 @@ custom_target('Changelog',
build_by_default: false,
)
-meson.add_dist_script('meson_dist_script.sh', generate_version_h ? gitversion_h.full_path() : gitversion_h)
+meson.add_dist_script('meson_dist_script.sh',
+ generate_version_h ? gitversion_h.full_path() : gitversion_h,
+ meson.source_root(), meson.build_root())
################################################################################
diff --git a/meson_dist_script.sh b/meson_dist_script.sh
index d900d7d1db..63b389323e 100755
--- a/meson_dist_script.sh
+++ b/meson_dist_script.sh
@@ -1,6 +1,35 @@
#!/usr/bin/env bash
+GIT_VERSION_H="$1"
+
+# MESON_SOURCE_ROOT and MESON_BUILD_ROOT environment variables are
+# passed since meson 0.54.0 but we depend on 0.53.0 so I also pass them
+# as script arguments. When we bump out meson requirement, this test may
+# go away.
+if [ -z "$MESON_SOURCE_ROOT" ]; then
+ MESON_SOURCE_ROOT="$2"
+fi
+if [ -z "$MESON_BUILD_ROOT" ]; then
+ MESON_BUILD_ROOT="$3"
+fi
+
+# `meson dist` doesn't trigger a build, which is a problem because we
+# need to add some configured/built files. The case where we didn't
+# build at all is the less annoying (we'd get a failure, which is
+# actually acceptable as it warns us). But the case where we would copy
+# outdated data is much more insidious (such as wrong INSTALL
+# information or wrong git information) as it would be silent.
+# See: https://github.com/mesonbuild/meson/issues/10650
+# And: https://gitlab.gnome.org/GNOME/gimp/-/issues/7907
+# This is why we manually trigger, not only a reconfigure, but also a
+# rebuild of the main project before copying data around.
+
+# INSTALL file is generated at configure time.
+meson --reconfigure $MESON_SOURCE_ROOT
+# git-version.h is generated at build time.
+meson compile
+
cp -f 'INSTALL' "${MESON_DIST_ROOT}"
-# rm -f "${MESON_DIST_ROOT}/INSTALL.in"
+rm -f "${MESON_DIST_ROOT}/INSTALL.in"
-cp "$1" "${MESON_DIST_ROOT}"
+cp "$GIT_VERSION_H" "${MESON_DIST_ROOT}"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]