[geary] Use GNOME odd/even version numbering to detect if running -dev
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Use GNOME odd/even version numbering to detect if running -dev
- Date: Sun, 28 Apr 2019 09:44:22 +0000 (UTC)
commit 322bdd2d4212b8189c48a14e15f42ad36a9bde11
Author: Michael Gratton <mike vee net>
Date: Sun Apr 28 17:55:59 2019 +1000
Use GNOME odd/even version numbering to detect if running -dev
Since switching to the GNOME release schedule, we need to do unstable
releases off of mainline, which means we need to update the version
number (and drop the "-dev" suffix) so tarballs etc get the right
version.
Instead of looking for the -dev suffix, parse the version number
to determine if we should display the revision in About.
meson.build | 6 +++-
src/client/application/geary-application.vala | 41 ++++++++++++++++++++++++---
src/console/main.vala | 2 +-
src/geary-version.vala.in | 17 ++++++++---
src/meson.build | 29 +++++++++----------
5 files changed, 69 insertions(+), 26 deletions(-)
---
diff --git a/meson.build b/meson.build
index cc557b58..08115c93 100644
--- a/meson.build
+++ b/meson.build
@@ -182,9 +182,13 @@ conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir)
conf.set_quoted('LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
conf.set_quoted('ISO_CODE_639_XML', iso_639_xml)
conf.set_quoted('ISO_CODE_3166_XML', iso_3166_xml)
+conf.set('GCR_API_SUBJECT_TO_CHANGE', true)
conf.set('HAVE_FTS3_TOKENIZE', true)
+# geary-version.vala.in gets configured twice (once for the version,
+# once for the revision), so make sure the revision template carries
+# through to the second time.
+conf.set('REVISION', '@REVISION@')
conf.set('VERSION', meson.project_version())
-conf.set('GCR_API_SUBJECT_TO_CHANGE', true)
configure_file(output: 'config.h', configuration: conf)
# Post-install scripts
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 69d00b97..bd413d3e 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -28,7 +28,7 @@ public class GearyApplication : Gtk.Application {
public const string WEBSITE_LABEL = _("Visit the Geary web site");
public const string BUGREPORT = "https://wiki.gnome.org/Apps/Geary/ReportingABug";
- public const string VERSION = Geary.Version.GEARY_VERSION;
+ public const string VERSION = Geary.Version.NUMBER;
public const string INSTALL_PREFIX = _INSTALL_PREFIX;
public const string GSETTINGS_DIR = _GSETTINGS_DIR;
public const string SOURCE_ROOT_DIR = _SOURCE_ROOT_DIR;
@@ -66,6 +66,7 @@ public class GearyApplication : Gtk.Application {
// Local-only command line options
private const string OPTION_VERSION = "version";
+ private const string OPTION_VERSION_FULL = "version-full";
// Local command line options
private const string OPTION_DEBUG = "debug";
@@ -146,6 +147,10 @@ public class GearyApplication : Gtk.Application {
/// Command line option
N_("Display program version"), null },
// Use this to specify arguments in the help section
+ { OPTION_VERSION_FULL, 'V', 0, GLib.OptionArg.NONE, null,
+ /// Command line option
+ N_("Display program version and revision id"), null },
+ // Use this to specify arguments in the help section
{ GLib.OPTION_REMAINING, 0, 0, GLib.OptionArg.STRING_ARRAY, null, null,
"[mailto:[...]]" },
{ null }
@@ -271,6 +276,7 @@ public class GearyApplication : Gtk.Application {
/// Application runtime information label
info.add({ _("Geary version"), VERSION });
+ info.add({ _("Geary revision"), Geary.Version.ID });
/// Application runtime information label
info.add({ _("GTK version"),
"%u.%u.%u".printf(
@@ -385,6 +391,14 @@ public class GearyApplication : Gtk.Application {
"%s: %s\n", this.binary, GearyApplication.VERSION
);
return 0;
+ } else if (options.contains(OPTION_VERSION_FULL)) {
+ GLib.stdout.printf(
+ "%s: %s (%s)\n",
+ this.binary,
+ GearyApplication.VERSION,
+ Geary.Version.ID
+ );
+ return 0;
}
return -1;
@@ -469,6 +483,22 @@ public class GearyApplication : Gtk.Application {
public async void show_about() {
yield this.present();
+ // Use just the version string for stable builds, i.e. those
+ // with even-numbered minor revisions like "3.32.0", but show
+ // the version number and revision for unstable builds
+ // i.e. those with odd-numbered minor revisions like "3.33.0"
+ string displayed_version = VERSION;
+ string[] version_parts = VERSION.split(".");
+ if (version_parts.length >= 2) {
+ int minor = int.parse(version_parts[1]);
+ if (minor % 2 == 1) {
+ displayed_version = "%s (%s)".printf(
+ Geary.Version.NUMBER,
+ Geary.Version.ID
+ );
+ }
+ }
+
Gtk.show_about_dialog(get_active_window(),
"program-name", NAME,
"comments", DESCRIPTION,
@@ -476,7 +506,7 @@ public class GearyApplication : Gtk.Application {
"copyright", string.join("\n", COPYRIGHT_1, COPYRIGHT_2),
"license-type", Gtk.License.LGPL_2_1,
"logo-icon-name", APP_ID,
- "version", VERSION,
+ "version", displayed_version,
"website", WEBSITE,
"website-label", WEBSITE_LABEL,
"title", _("About %s").printf(NAME),
@@ -674,8 +704,11 @@ public class GearyApplication : Gtk.Application {
lock (this.controller) {
if (this.controller == null) {
message(
- "%s %s prefix=%s exec_dir=%s is_installed=%s",
- NAME, VERSION, INSTALL_PREFIX,
+ "%s %s (%s) prefix=%s exec_dir=%s is_installed=%s",
+ NAME,
+ VERSION,
+ Geary.Version.ID,
+ INSTALL_PREFIX,
exec_dir.get_path(),
this.is_installed.to_string()
);
diff --git a/src/console/main.vala b/src/console/main.vala
index 8a95acbc..b3e69fa0 100644
--- a/src/console/main.vala
+++ b/src/console/main.vala
@@ -409,7 +409,7 @@ class ImapConsole : Gtk.Window {
Gee.HashMap<string, string> fields = new Gee.HashMap<string, string>();
fields.set("name", "geary-console");
- fields.set("version", Geary.Version.GEARY_VERSION);
+ fields.set("version", Geary.Version.NUMBER);
this.cx.send_command(new Geary.Imap.IdCommand(fields));
}
diff --git a/src/geary-version.vala.in b/src/geary-version.vala.in
index 42a45a36..cb2fcdcb 100644
--- a/src/geary-version.vala.in
+++ b/src/geary-version.vala.in
@@ -1,9 +1,18 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
+/*
+ * Copyright 2016 Software Freedom Conservancy Inc.
+ * Copyright 2019 Michael Gratton <mike vee net>
*
* This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later). See the COPYING file in this distribution.
+ * (version 2.1 or later). See the COPYING file in this distribution.
*/
+/** Provides access to Engine version and revision numbers. */
namespace Geary.Version {
-public const string GEARY_VERSION = "@VERSION@";
-}
\ No newline at end of file
+
+ /** The current version number for this build. */
+ public const string NUMBER = "@VERSION@";
+
+ /** The source code identifier for this build. */
+ public const string ID = "@REVISION@";
+
+}
diff --git a/src/meson.build b/src/meson.build
index 175c4aa9..efeb9407 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,21 +1,18 @@
# Version
-if meson.project_version().endswith('-dev')
- # Development build
- geary_version_vala = vcs_tag(
- command: '../build-aux/git_version.py',
- input: 'geary-version.vala.in',
- output: 'geary-version.vala',
- replace_string: '@VERSION@'
- )
-else
- # Release build
- geary_version_vala = configure_file(
- input: 'geary-version.vala.in',
- output: 'geary-version.vala',
- configuration: conf,
- )
-endif
+geary_version_in = configure_file(
+ input: 'geary-version.vala.in',
+ output: 'geary-version.vala.in',
+ configuration: conf,
+ install: false
+)
+
+geary_version_vala = vcs_tag(
+ command: '../build-aux/git_version.py',
+ input: geary_version_in,
+ output: 'geary-version.vala',
+ replace_string: '@REVISION@'
+)
# Common vala options
geary_vala_options = [
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]