summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Ružička <jakub.ruzicka@nic.cz>2023-06-13 21:23:07 +0200
committerJakub Ružička <jakub.ruzicka@nic.cz>2023-06-22 16:26:31 +0200
commit05c14ab5bfc914c7f7d72190b363e68ea508d99a (patch)
tree454416ac0f6cedd6a9a586062e8e078ff92a7e7c
parentscripts: improve make-archive.sh script (diff)
downloadknot-resolver-05c14ab5bfc914c7f7d72190b363e68ea508d99a.tar.xz
knot-resolver-05c14ab5bfc914c7f7d72190b363e68ea508d99a.zip
scripts: shorten devel version string
It's now also PEP440 compatible. Before: 6.0.0.1686682076.ad1eaf76.tar.xz Now: 6.0.0.dev157+1bcc45.tar.xz
-rwxr-xr-xscripts/make-archive.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/make-archive.sh b/scripts/make-archive.sh
index b9d00aa4..b2962289 100755
--- a/scripts/make-archive.sh
+++ b/scripts/make-archive.sh
@@ -11,11 +11,14 @@ cd "$(dirname ${0})/.."
if ! git describe --tags --exact-match; then
# devel version
- GIT_HASH=$(git rev-parse --short HEAD )
- TIMESTAMP=$(date -u +'%s' 2>/dev/null)
+ VERSION_TAG=$(git tag --merged HEAD --sort=-taggerdate | head -1)
+ VERSION=${VERSION_TAG#v}
+ GIT_HASH=$(git rev-parse --short=6 HEAD)
+ N_COMMITS=$(git rev-list $VERSION_TAG.. --count)
+ FULL_VERSION="$VERSION.dev$N_COMMITS+$GIT_HASH"
# modify and commit meson.build
- sed -i "s/^\(\s*version\s*:\s*'\)\([^']\+\)\('.*\)/\1\2.$TIMESTAMP.$GIT_HASH\3/" meson.build
+ sed -i "s/^\(\s*version\s*:\s*'\)\([^']\+\)\('.*\)/\1$FULL_VERSION\3/" meson.build
: changed version in meson.build, changes must be committed to git
git add meson.build