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).
This commit is contained in:
@ -4,6 +4,7 @@ AUTOMAKE_OPTIONS = subdir-objects
|
|||||||
|
|
||||||
libapp = $(top_builddir)/app/libapp.a
|
libapp = $(top_builddir)/app/libapp.a
|
||||||
libappwidgets = $(top_builddir)/app/widgets/libappwidgets.a
|
libappwidgets = $(top_builddir)/app/widgets/libappwidgets.a
|
||||||
|
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
|
||||||
|
|
||||||
if PLATFORM_OSX
|
if PLATFORM_OSX
|
||||||
xobjective_c = "-xobjective-c"
|
xobjective_c = "-xobjective-c"
|
||||||
@ -41,6 +42,7 @@ gimp_debug_tool_@GIMP_TOOL_VERSION@_CPPFLAGS = \
|
|||||||
gimp_debug_tool_@GIMP_TOOL_VERSION@_LDADD = \
|
gimp_debug_tool_@GIMP_TOOL_VERSION@_LDADD = \
|
||||||
$(libappwidgets) \
|
$(libappwidgets) \
|
||||||
$(libapp) \
|
$(libapp) \
|
||||||
|
$(libgimpbase) \
|
||||||
$(GIO_LIBS) \
|
$(GIO_LIBS) \
|
||||||
$(GEGL_LIBS) \
|
$(GEGL_LIBS) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
#include "gimp-update.h"
|
#include "gimp-update.h"
|
||||||
|
#include "gimp-version.h"
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -205,7 +206,7 @@ gimp_check_updates_callback (GObject *source,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (build_revision <= GIMP_BUILD_REVISION)
|
if (build_revision <= gimp_version_get_revision ())
|
||||||
{
|
{
|
||||||
/* Already using the last officially released
|
/* Already using the last officially released
|
||||||
* revision. */
|
* revision. */
|
||||||
|
@ -227,7 +227,9 @@ gimp_version (gboolean be_verbose,
|
|||||||
"# C compiler #\n%s\n"
|
"# C compiler #\n%s\n"
|
||||||
"# Libraries #\n%s",
|
"# Libraries #\n%s",
|
||||||
GIMP_GIT_VERSION,
|
GIMP_GIT_VERSION,
|
||||||
GIMP_BUILD_ID, GIMP_BUILD_REVISION, GIMP_BUILD_PLATFORM,
|
GIMP_BUILD_ID,
|
||||||
|
gimp_version_get_revision (),
|
||||||
|
GIMP_BUILD_PLATFORM,
|
||||||
CC_VERSION,
|
CC_VERSION,
|
||||||
lib_versions);
|
lib_versions);
|
||||||
g_free (lib_versions);
|
g_free (lib_versions);
|
||||||
@ -240,3 +242,33 @@ gimp_version (gboolean be_verbose,
|
|||||||
|
|
||||||
return version;
|
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;
|
||||||
|
}
|
||||||
|
@ -23,5 +23,6 @@ void gimp_version_show (gboolean be_verbose);
|
|||||||
gchar * gimp_version (gboolean be_verbose,
|
gchar * gimp_version (gboolean be_verbose,
|
||||||
gboolean localized);
|
gboolean localized);
|
||||||
|
|
||||||
|
gint gimp_version_get_revision (void);
|
||||||
|
|
||||||
#endif /* __APP_GIMP_VERSION_H__ */
|
#endif /* __APP_GIMP_VERSION_H__ */
|
||||||
|
Reference in New Issue
Block a user