summaryrefslogtreecommitdiffstats
path: root/m4/knot-version.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:24:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:24:08 +0000
commitf449f278dd3c70e479a035f50a9bb817a9b433ba (patch)
tree8ca2bfb785dda9bb4d573acdf9b42aea9cd51383 /m4/knot-version.m4
parentInitial commit. (diff)
downloadknot-f449f278dd3c70e479a035f50a9bb817a9b433ba.tar.xz
knot-f449f278dd3c70e479a035f50a9bb817a9b433ba.zip
Adding upstream version 3.2.6.upstream/3.2.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/knot-version.m4')
-rw-r--r--m4/knot-version.m423
1 files changed, 23 insertions, 0 deletions
diff --git a/m4/knot-version.m4 b/m4/knot-version.m4
new file mode 100644
index 0000000..f39486f
--- /dev/null
+++ b/m4/knot-version.m4
@@ -0,0 +1,23 @@
+################################################################################
+# Knot DNS versions are as follows
+#
+# <MAJOR>.<MINOR>.dev[.<TIMESTAMP>.<HASH>] Build from the master branch
+# <MAJOR>.<MINOR>.<PATCH>[.<TIMESTAMP>.<HASH>] Build from a feature branch
+#
+# To force release version format set env variable KNOT_VERSION_FORMAT=release
+#
+# If the repository is not available or if HEAD is tagged,
+# the optional part is missing!
+#
+# Example: 2.7.dev.1521027664.5e69ccc
+################################################################################
+
+m4_define([knot_PATCH], m4_ifblank(knot_VERSION_PATCH, [dev], knot_VERSION_PATCH))dnl
+
+m4_define([knot_GIT_HASH], m4_esyscmd_s(git rev-parse --short HEAD 2>/dev/null))dnl
+m4_define([knot_GIT_TAG], m4_esyscmd_s(git describe --exact-match 2>/dev/null))dnl
+m4_define([knot_TIMESTAMP], m4_esyscmd_s(date -u +'%s' 2>/dev/null))dnl
+m4_define([knot_GIT_OK], m4_case(m4_esyscmd_s(echo $KNOT_VERSION_FORMAT 2>/dev/null), release, [], knot_GIT_HASH))dnl
+m4_define([knot_GIT_INFO], m4_ifblank(knot_GIT_TAG, m4_ifnblank(knot_GIT_OK, .knot_TIMESTAMP.knot_GIT_HASH, []), []))dnl
+
+m4_define([knot_PKG_VERSION], [knot_VERSION_MAJOR.knot_VERSION_MINOR.knot_PATCH]knot_GIT_INFO)dnl