summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorOto Šťáva <oto.stava@nic.cz>2024-08-23 14:57:31 +0200
committerAleš Mrázek <ales.mrazek@nic.cz>2024-08-26 14:28:10 +0200
commita8da26abcf9217c437cab31457714e2222f1711b (patch)
treef23e3e9ebc0e37b3a38bfe3ae85b268061a9b64f /scripts/lib
parenttests/integration/deckard: update to latest master (diff)
downloadknot-resolver-a8da26abcf9217c437cab31457714e2222f1711b.tar.xz
knot-resolver-a8da26abcf9217c437cab31457714e2222f1711b.zip
scripts: organize into subdirs and clean up unused
Diffstat (limited to 'scripts/lib')
-rwxr-xr-xscripts/lib/get-date.sh14
-rwxr-xr-xscripts/lib/upstream-version.sh9
2 files changed, 23 insertions, 0 deletions
diff --git a/scripts/lib/get-date.sh b/scripts/lib/get-date.sh
new file mode 100755
index 00000000..1480f984
--- /dev/null
+++ b/scripts/lib/get-date.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+set -o nounset
+cd "$(dirname $0)/../.."
+
+# Get date from NEWS if possible (regular release)
+DATE=$(head -n1 < NEWS | sed 's/.*(\(.*\)).*/\1/' | grep -E '^[0-9]{4}-[0-9]{2}-[0-9]{2}$$')
+
+if [[ $? -ne 0 ]]; then
+ # or use last modification time of NEWS (dev versions)
+ DATE=$(date -u -r NEWS +%F)
+fi
+
+echo -n $DATE
diff --git a/scripts/lib/upstream-version.sh b/scripts/lib/upstream-version.sh
new file mode 100755
index 00000000..4efa42db
--- /dev/null
+++ b/scripts/lib/upstream-version.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# return latest upstream version of Knot Resolver
+set -o errexit
+
+REPO=https://gitlab.nic.cz/knot/knot-resolver.git
+
+git ls-remote --tags --refs $REPO | cut -f2- | sed -n "s#^refs/tags/v##p" | sort -V | tail -1