summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2022-01-28 14:51:57 -0500
committerRay Strode <rstrode@redhat.com>2022-01-28 15:12:30 -0500
commite4a0b113ed86cda74413a1b439ebc1a5dda99087 (patch)
treee5245ea0c98c717a066dab7c9b6645fe64c83d52
parentb5903d5ae36f022117fe9b0c5308525c39cf5dc2 (diff)
downloadaccountsservice-e4a0b113ed86cda74413a1b439ebc1a5dda99087.tar.gz
meson: Determine project version from date
Numbers are arbitrary, and we've never successfully made it to version 1.0 after like 12 years or something. Furthermore, accountsservice has a very slow release schedule at present and some distros hate building from git. So, I'd like to start generating tarballs more regularly. Adopting a version number derived from the date will help facilitate that. This commit introduces a script to figure out the version number based on the date and the number of commits since the last release.
-rwxr-xr-xgenerate-version.sh11
-rw-r--r--meson.build2
2 files changed, 12 insertions, 1 deletions
diff --git a/generate-version.sh b/generate-version.sh
new file mode 100755
index 0000000..02c5f80
--- /dev/null
+++ b/generate-version.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+VERSION_FROM_DIR_NAME=$(dirname $PWD/.. | sed -n 's/^.*-\([^-]*\)$/\1/p')
+
+if [ -n "$VERSION_FROM_DIR_NAME" ]; then
+ echo "$VERSION_FROM_DIR_NAME"
+ exit 0
+fi
+
+COMMITS_SINCE_LAST_RELEASE=$(git rev-list $(git describe --abbrev=0)..HEAD --count)
+date +%y.%V.${COMMITS_SINCE_LAST_RELEASE}
+
diff --git a/meson.build b/meson.build
index 7d4dd77..075776f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project(
'accountsservice', 'c',
- version: '0.6.55',
+ version: run_command(['./generate-version.sh']).stdout().strip(),
license: 'GPL3+',
default_options: 'buildtype=debugoptimized',
meson_version: '>= 0.50.0',