[gimp/gimp-2-10] app, autotools: new GIMP_RELEASE macro.



commit e4a9f1b35a154bb93e34cc6860e38e5bfbb190ff
Author: Jehan <jehan girinstud io>
Date:   Mon Sep 5 21:59:26 2022 +0200

    app, autotools: 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.
    
    (cherry picked from commit fbb5b403454810243c7bc95bbbb25a52821bfa28)

 app/gimp-update.c |  8 ++++----
 configure.ac      | 12 +++++++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/app/gimp-update.c b/app/gimp-update.c
index d164ecfabf..72f74e0366 100644
--- a/app/gimp-update.c
+++ b/app/gimp-update.c
@@ -416,13 +416,13 @@ gimp_update_about_dialog (GimpCoreConfig   *config,
 static const gchar *
 gimp_get_version_url ()
 {
-#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
 }
 
@@ -464,7 +464,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 01c312526b..2808558dcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,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
@@ -120,6 +123,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)
@@ -137,6 +141,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
@@ -219,10 +224,15 @@ AC_SUBST(XGETTEXT_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)])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]