From fbb5b403454810243c7bc95bbbb25a52821bfa28 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 5 Sep 2022 21:59:26 +0200 Subject: [PATCH] app, autotools, meson: new GIMP_RELEASE macro. We were using GIMP_UNSTABLE extensively to differentiate development from stable code. But there is actually another level of development code. Basically GIMP_UNSTABLE tells you are on the development branch, e.g. for current branches, that you are on 2.99.* versions (vs. 2.10). This depends on the minor version oddness. GIMP_RELEASE will tell you if it's a release or a in-between-releases code. This works with the micro version which must be even on release. Any odd number means you are basically using random git code. There can be any combination of GIMP_RELEASE and GIMP_UNSTABLE. For instance 2.99.12 is a release of the unstable branch, whereas 2.10.33 is development code of the stable branch. I use this first in the update code as we were using GIMP_UNSTABLE for both concepts but it made it harder to test. Now: * GIMP_DEV_VERSIONS_JSON environment variable is only available on development code, not on release (whether stable or unstable). * The weekly check limitation is also only for releases (dev code just check at every startup to quickly detect issues and regressions). * Whether to look on testing website or public website json file depends on the code being a release or not. * Finally only whether to check "DEVELOPMENT" or "STABLE" sections in the json file depends on whether we are on stable or unstable branches. --- app/gimp-update.c | 8 ++++---- configure.ac | 12 +++++++++++- meson.build | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/gimp-update.c b/app/gimp-update.c index 714c32755c..8c5cc18874 100644 --- a/app/gimp-update.c +++ b/app/gimp-update.c @@ -540,13 +540,13 @@ gimp_version_cmp (const gchar *v1, static const gchar * gimp_get_version_url (void) { -#ifdef GIMP_UNSTABLE +#ifdef GIMP_RELEASE + return "https://www.gimp.org/gimp_versions.json"; +#else if (g_getenv ("GIMP_DEV_VERSIONS_JSON")) return g_getenv ("GIMP_DEV_VERSIONS_JSON"); else return "https://testing.gimp.org/gimp_versions.json"; -#else - return "https://www.gimp.org/gimp_versions.json"; #endif } @@ -607,7 +607,7 @@ gimp_update_auto_check (GimpCoreConfig *config, if (prev_update_timestamp > current_timestamp) prev_update_timestamp = -1; -#ifndef GIMP_UNSTABLE +#ifdef GIMP_RELEASE /* Do not check more than once a week. */ if (current_timestamp - prev_update_timestamp < 3600L * 24L * 7L) return FALSE; diff --git a/configure.ac b/configure.ac index 6851a889b1..a9a4874f43 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,9 @@ m4_define([gimp_unstable], m4_define([gimp_stable], m4_if(m4_eval(gimp_minor_version % 2), [0], [yes], [no])) +m4_define([gimp_release], + m4_if(m4_eval(gimp_micro_version % 2), [0], [yes], [no])) + m4_define([gimp_full_name], [GNU Image Manipulation Program]) # required versions of other packages @@ -129,6 +132,7 @@ GIMP_DATA_VERSION=gimp_data_version GIMP_SYSCONF_VERSION=gimp_sysconf_version GIMP_USER_VERSION=gimp_user_version GIMP_UNSTABLE=gimp_unstable +GIMP_RELEASE=gimp_release GIMP_FULL_NAME="gimp_full_name" AC_SUBST(GIMP_MAJOR_VERSION) AC_SUBST(GIMP_MINOR_VERSION) @@ -148,6 +152,7 @@ AC_SUBST(GIMP_DATA_VERSION) AC_SUBST(GIMP_SYSCONF_VERSION) AC_SUBST(GIMP_USER_VERSION) AC_SUBST(GIMP_UNSTABLE) +AC_SUBST(GIMP_RELEASE) AC_SUBST(GIMP_FULL_NAME) # Version strings used in some source, though it seems unnecessary to @@ -234,10 +239,15 @@ AC_SUBST(LIBUNWIND_REQUIRED_VERSION) # and automake conditional. if test "x$GIMP_UNSTABLE" = "xyes"; then AC_DEFINE(GIMP_UNSTABLE, 1, - [Define to 1 if this is an unstable version of GIMP]) + [Define to 1 if this is code from the unstable branch of GIMP]) fi AM_CONDITIONAL(GIMP_UNSTABLE, test "x$GIMP_UNSTABLE" = "xyes") +if test "x$GIMP_RELEASE" = "xyes"; then + AC_DEFINE(GIMP_RELEASE, 1, + [Define to 1 if this is a release version of GIMP]) +fi +AM_CONDITIONAL(GIMP_RELEASE, test "x$GIMP_RELEASE" = "xyes") # libtool versioning m4_define([lt_current], [m4_eval(100 * gimp_minor_version + gimp_micro_version - gimp_interface_age)]) diff --git a/meson.build b/meson.build index 574a8a1c76..e777f5e6dc 100644 --- a/meson.build +++ b/meson.build @@ -59,9 +59,14 @@ conf.set_quoted('GETTEXT_PACKAGE', gettext_package) conf.set_quoted('GIMP_VERSION', gimp_version) +# GIMP_UNSTABLE tells if we are on an unstable or stable development branch. stable = (gimp_app_version_minor % 2 == 0) conf.set('GIMP_UNSTABLE', stable ? false : 1) +# GIMP_RELEASE tells if this is a release or in-between release (git) code. +release = (gimp_app_version_micro % 2 == 0) +conf.set('GIMP_RELEASE', release ? 1 : false) + versionconfig = configuration_data() versionconfig.set('GIMP_FULL_NAME', full_name) versionconfig.set('GIMP_MAJOR_VERSION', gimp_app_version_major)