Commit 87e9ebcf authored by Jehan's avatar Jehan

app: store the revision number in a data file.

I realized having the revision as a build number is the wrong idea as it
implies packagers will have to rebuild GIMP for just a revision. Yet
very often revision may just be data change or dependency fix/update
without rebuild needed (i.e. no ABI change).
Instead let's keep this package information as a file 'gimp-release'
(inspired by /etc/os-release and other /etc/*-release files of
distributions).
parent 7029c357
......@@ -4,6 +4,7 @@ AUTOMAKE_OPTIONS = subdir-objects
libapp = $(top_builddir)/app/libapp.a
libappwidgets = $(top_builddir)/app/widgets/libappwidgets.a
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
if PLATFORM_OSX
xobjective_c = "-xobjective-c"
......@@ -41,6 +42,7 @@ gimp_debug_tool_@GIMP_TOOL_VERSION@_CPPFLAGS = \
gimp_debug_tool_@GIMP_TOOL_VERSION@_LDADD = \
$(libappwidgets) \
$(libapp) \
$(libgimpbase) \
$(GIO_LIBS) \
$(GEGL_LIBS) \
$(GTK_LIBS) \
......
......@@ -40,6 +40,7 @@
#include "gimp-intl.h"
#include "gimp-update.h"
#include "gimp-version.h"
static gboolean
......@@ -205,7 +206,7 @@ gimp_check_updates_callback (GObject *source,
break;
}
}
if (build_revision <= GIMP_BUILD_REVISION)
if (build_revision <= gimp_version_get_revision ())
{
/* Already using the last officially released
* revision. */
......
......@@ -227,7 +227,9 @@ gimp_version (gboolean be_verbose,
"# C compiler #\n%s\n"
"# Libraries #\n%s",
GIMP_GIT_VERSION,
GIMP_BUILD_ID, GIMP_BUILD_REVISION, GIMP_BUILD_PLATFORM,
GIMP_BUILD_ID,
gimp_version_get_revision (),
GIMP_BUILD_PLATFORM,
CC_VERSION,
lib_versions);
g_free (lib_versions);
......@@ -240,3 +242,33 @@ gimp_version (gboolean be_verbose,
return version;
}
gint
gimp_version_get_revision (void)
{
GKeyFile *key_file;
gchar *gimp_release;
gint revision = 0;
key_file = g_key_file_new ();
/* The gimp-release file is inspired by /etc/os-release and similar
* distribution files. Right now its main use is to number the package
* revision. This information is not a build variable because a new
* package version does not necessarily imply a rebuild (maybe just
* installed data or dependencies change).
*/
gimp_release = g_build_filename (gimp_data_directory (), "gimp-release", NULL);
/* Absence of the file is not an error. Actually most third-party
* builds probably won't install such file.
*/
if (g_key_file_load_from_file (key_file, gimp_release, G_KEY_FILE_NONE, NULL))
{
if (g_key_file_has_key (key_file, "package", "revision", NULL))
revision = g_key_file_get_integer (key_file, "package", "revision", NULL);
}
g_key_file_free (key_file);
g_free (gimp_release);
return revision;
}
......@@ -19,9 +19,10 @@
#define __APP_GIMP_VERSION_H__
void gimp_version_show (gboolean be_verbose);
gchar * gimp_version (gboolean be_verbose,
gboolean localized);
void gimp_version_show (gboolean be_verbose);
gchar * gimp_version (gboolean be_verbose,
gboolean localized);
gint gimp_version_get_revision (void);
#endif /* __APP_GIMP_VERSION_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment