[gcab] gcab: add git version in --version



commit 9e4f91f955eb3be3de483fc37e2ac2be887eb6ac
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Tue Jan 23 19:21:37 2018 +0100

    gcab: add git version in --version
    
    We lost this in meson conversion. Actually meson lacks some of the
    git-version-gen functions (tarball version etc, there are open issues
    to meson about it). And vcs_tag isn't really nice either.
    
    For now, bring back git version in gcab --version.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 meson.build |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/meson.build b/meson.build
index 158d7d3..1a29b5a 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,8 @@ project('gcab', 'c',
   default_options : ['warning_level=2', 'c_std=c99'],
 )
 
+git_version = run_command(['git', 'describe', '--abbrev=4', 'HEAD']).stdout().strip().split('-')
+
 # libtool versioning
 lt_current = '0'
 lt_revision = '0'
@@ -93,7 +95,12 @@ i18n = import('i18n')
 conf = configuration_data()
 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 conf.set_quoted('PACKAGE_NAME', meson.project_name())
-conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
+if git_version.length() == 3
+  conf.set_quoted('PACKAGE_STRING', '@0@ @1@.@2@-@3@'.format(meson.project_name(), git_version[0], 
git_version[1], git_version[2]))
+else
+  conf.set_quoted('PACKAGE_STRING', '@0@ v@1@'.format(meson.project_name(), meson.project_version()))
+endif
+
 conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
 conf.set_quoted('PACKAGE_BUGREPORT', 
'https://bugzilla.gnome.org/enter_bug.cgi?product=msitools&component=gcab')
 conf.set_quoted('TESTDATADIR', join_paths(meson.source_root(), 'tests'))


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