From 7540596247af87fadc6dff613d026772385185f4 Mon Sep 17 00:00:00 2001 From: Rafael Mardojai CM Date: Sat, 12 Sep 2020 19:32:12 -0500 Subject: [PATCH] Use git revision as app version better for daily builds --- build-aux/meson/revision.sh | 9 +++++++++ src/blanket.in | 3 ++- src/meson.build | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 build-aux/meson/revision.sh diff --git a/build-aux/meson/revision.sh b/build-aux/meson/revision.sh new file mode 100644 index 0000000..3e8e118 --- /dev/null +++ b/build-aux/meson/revision.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# forked from https://gitlab.gnome.org/World/lollypop/-/blob/master/bin/revision.sh +VERSION="@VERSION@" +if [[ $VERSION != "@VERSION@" ]] +then + echo $VERSION +else + git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +fi diff --git a/src/blanket.in b/src/blanket.in index 53f88ba..1734bc7 100755 --- a/src/blanket.in +++ b/src/blanket.in @@ -24,6 +24,7 @@ import locale import gettext VERSION = '@VERSION@' +REVISION = '@REVISION@' pkgdatadir = '@pkgdatadir@' localedir = '@localedir@' @@ -45,4 +46,4 @@ if __name__ == '__main__': resource._register() from blanket import main - sys.exit(main.main(VERSION)) + sys.exit(main.main(REVISION)) diff --git a/src/meson.build b/src/meson.build index 426a079..1c6061f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,11 +1,17 @@ pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) moduledir = join_paths(pkgdatadir, 'blanket') +revision = run_command('../build-aux/meson/revision.sh').stdout().strip() +if revision == '' + revision=meson.project_version() +endif + python = import('python') conf = configuration_data() conf.set('PYTHON', python.find_installation('python3').path()) conf.set('VERSION', meson.project_version()) +conf.set('REVISION', revision) conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir)