Issue #12641: Help>About GIMP dialog does not show an update in 3.0 RC1.
RC numbering was not taken into account for version comparison.
This commit is contained in:
parent
33ab56f554
commit
4e57e7b4ea
3 changed files with 79 additions and 18 deletions
|
|
@ -1141,8 +1141,11 @@ gimp_core_config_set_property (GObject *object,
|
|||
core_config->last_revision = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_KNOWN_RELEASE:
|
||||
g_clear_pointer (&core_config->last_known_release, g_free);
|
||||
core_config->last_known_release = g_value_dup_string (value);
|
||||
if (core_config->last_known_release != g_value_get_string (value))
|
||||
{
|
||||
g_clear_pointer (&core_config->last_known_release, g_free);
|
||||
core_config->last_known_release = g_value_dup_string (value);
|
||||
}
|
||||
break;
|
||||
case PROP_CONFIG_VERSION:
|
||||
g_clear_pointer (&core_config->config_version, g_free);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ static void gimp_update_about_dialog (GimpCoreConfig *config,
|
|||
static gboolean gimp_version_break (const gchar *v,
|
||||
gint *major,
|
||||
gint *minor,
|
||||
gint *micro);
|
||||
gint *micro,
|
||||
gint *rc,
|
||||
gboolean *is_git);
|
||||
static gint gimp_version_cmp (const gchar *v1,
|
||||
const gchar *v2);
|
||||
|
||||
|
|
@ -365,7 +367,7 @@ gimp_check_updates_process (const gchar *source,
|
|||
gimp_update_get_highest (parser, &last_version, &release_timestamp,
|
||||
&build_revision, &build_comment, FALSE);
|
||||
|
||||
#ifdef GIMP_UNSTABLE
|
||||
#if defined(GIMP_UNSTABLE) || defined(GIMP_RC_VERSION)
|
||||
{
|
||||
gchar *dev_version = NULL;
|
||||
gchar *dev_comment = NULL;
|
||||
|
|
@ -461,13 +463,17 @@ static gboolean
|
|||
gimp_version_break (const gchar *v,
|
||||
gint *major,
|
||||
gint *minor,
|
||||
gint *micro)
|
||||
gint *micro,
|
||||
gint *rc,
|
||||
gboolean *is_git)
|
||||
{
|
||||
gchar **versions;
|
||||
|
||||
*major = 0;
|
||||
*minor = 0;
|
||||
*micro = 0;
|
||||
*major = 0;
|
||||
*minor = 0;
|
||||
*micro = 0;
|
||||
*rc = 0;
|
||||
*is_git = FALSE;
|
||||
|
||||
if (v == NULL)
|
||||
return FALSE;
|
||||
|
|
@ -481,10 +487,40 @@ gimp_version_break (const gchar *v,
|
|||
*minor = g_ascii_strtoll (versions[1], NULL, 10);
|
||||
if (versions[2] != NULL)
|
||||
{
|
||||
gchar **micro_rc_git;
|
||||
|
||||
*micro = g_ascii_strtoll (versions[2], NULL, 10);
|
||||
|
||||
micro_rc_git = g_strsplit_set (versions[2], "-", 2);
|
||||
|
||||
if (g_strv_length (micro_rc_git) > 1 &&
|
||||
strlen (micro_rc_git[1]) > 2 &&
|
||||
micro_rc_git[1][0] == 'R' &&
|
||||
micro_rc_git[1][1] == 'C')
|
||||
{
|
||||
gchar **rc_git;
|
||||
|
||||
*rc = g_ascii_strtoll (micro_rc_git[1] + 2, NULL, 10);
|
||||
|
||||
rc_git = g_strsplit_set (micro_rc_git[1], "+", 2);
|
||||
|
||||
if (g_strv_length (rc_git) > 1 &&
|
||||
strlen (rc_git[1]) == 3 &&
|
||||
rc_git[1][0] == 'g' &&
|
||||
rc_git[1][1] == 'i' &&
|
||||
rc_git[1][2] == 't')
|
||||
{
|
||||
*is_git = TRUE;
|
||||
}
|
||||
|
||||
g_strfreev (rc_git);
|
||||
}
|
||||
|
||||
g_strfreev (micro_rc_git);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (versions);
|
||||
|
||||
return (*major > 0 || *minor > 0 || *micro > 0);
|
||||
|
|
@ -508,13 +544,24 @@ gimp_version_cmp (const gchar *v1,
|
|||
gint major1;
|
||||
gint minor1;
|
||||
gint micro1;
|
||||
gint major2 = GIMP_MAJOR_VERSION;
|
||||
gint minor2 = GIMP_MINOR_VERSION;
|
||||
gint micro2 = GIMP_MICRO_VERSION;
|
||||
gint rc1;
|
||||
gboolean is_git1;
|
||||
gint major2 = GIMP_MAJOR_VERSION;
|
||||
gint minor2 = GIMP_MINOR_VERSION;
|
||||
gint micro2 = GIMP_MICRO_VERSION;
|
||||
gint rc2 = 0;
|
||||
gboolean is_git2 = FALSE;
|
||||
|
||||
#if defined(GIMP_RC_VERSION)
|
||||
rc2 = GIMP_RC_VERSION;
|
||||
#if defined(GIMP_IS_RC_GIT)
|
||||
is_git2 = TRUE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail (v1 != NULL, -1);
|
||||
|
||||
if (! gimp_version_break (v1, &major1, &minor1, µ1))
|
||||
if (! gimp_version_break (v1, &major1, &minor1, µ1, &rc1, &is_git1))
|
||||
{
|
||||
/* If version is not properly parsed, something is wrong with
|
||||
* upstream version number or parsing. This should not happen.
|
||||
|
|
@ -524,7 +571,7 @@ gimp_version_cmp (const gchar *v1,
|
|||
|
||||
return -1;
|
||||
}
|
||||
if (v2 && ! gimp_version_break (v2, &major2, &minor2, µ2))
|
||||
if (v2 && ! gimp_version_break (v2, &major2, &minor2, µ2, &rc2, &is_git2))
|
||||
{
|
||||
g_printerr ("%s: version not properly formatted: %s\n",
|
||||
G_STRFUNC, v2);
|
||||
|
|
@ -532,11 +579,16 @@ gimp_version_cmp (const gchar *v1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (major1 == major2 && minor1 == minor2 && micro1 == micro2)
|
||||
if (major1 == major2 && minor1 == minor2 && micro1 == micro2 &&
|
||||
rc1 == rc2 && is_git1 == is_git2)
|
||||
return 0;
|
||||
else if (major1 > major2 ||
|
||||
(major1 == major2 && minor1 > minor2) ||
|
||||
(major1 == major2 && minor1 == minor2 && micro1 > micro2))
|
||||
else if (major1 > major2 ||
|
||||
(major1 == major2 && minor1 > minor2) ||
|
||||
(major1 == major2 && minor1 == minor2 && micro1 > micro2) ||
|
||||
/* RC 0 is the real release, so it's "higher" than any other. */
|
||||
(major1 == major2 && minor1 == minor2 && micro1 == micro2 && rc1 == 0 && rc2 > 0) ||
|
||||
(major1 == major2 && minor1 == minor2 && micro1 == micro2 && rc1 > rc2 && rc2 > 0) ||
|
||||
(major1 == major2 && minor1 == minor2 && micro1 == micro2 && rc1 == rc2 && is_git1))
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
|
|
@ -545,7 +597,7 @@ gimp_version_cmp (const gchar *v1,
|
|||
static const gchar *
|
||||
gimp_get_version_url (void)
|
||||
{
|
||||
#ifdef GIMP_RELEASE
|
||||
#if defined(GIMP_RELEASE) && ! defined(GIMP_RC_VERSION)
|
||||
return "https://www.gimp.org/gimp_versions.json";
|
||||
#else
|
||||
if (g_getenv ("GIMP_DEV_VERSIONS_JSON"))
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ gimp_app_version_major = gimp_app_version_arr[0].to_int()
|
|||
gimp_app_version_minor = gimp_app_version_arr[1].to_int()
|
||||
gimp_app_micro_rc = gimp_app_version_arr[2].split('-')
|
||||
gimp_app_version_micro = gimp_app_micro_rc[0].to_int()
|
||||
gimp_app_version_rc = 0
|
||||
gimp_rc_git = false
|
||||
if gimp_app_micro_rc.length() > 1
|
||||
if not gimp_app_micro_rc[1].startswith('RC')
|
||||
|
|
@ -91,6 +92,11 @@ conf.set('GIMP_UNSTABLE', stable ? false : 1)
|
|||
release = (gimp_app_version_micro % 2 == 0)
|
||||
conf.set('GIMP_RELEASE', release ? 1 : false)
|
||||
|
||||
# GIMP_RC_VERSION can only be set on release candidates.
|
||||
conf.set('GIMP_RC_VERSION', release and gimp_app_version_rc > 0 ? gimp_app_version_rc : false)
|
||||
# GIMP_IS_GIT can only be set during development of a RC.
|
||||
conf.set('GIMP_IS_RC_GIT', gimp_rc_git)
|
||||
|
||||
versionconfig = configuration_data()
|
||||
versionconfig.set('GIMP_FULL_NAME', full_name)
|
||||
versionconfig.set('GIMP_MAJOR_VERSION', gimp_app_version_major)
|
||||
|
|
|
|||
Loading…
Reference in a new issue