summaryrefslogtreecommitdiffstats
path: root/meson/check-version.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
commite4283f6d48b98e764b988b43bbc86b9d52e6ec94 (patch)
treec8f7f7a6c2f5faa2942d27cefc6fd46cca492656 /meson/check-version.py
parentInitial commit. (diff)
downloadgnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.tar.xz
gnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.zip
Adding upstream version 43.9.upstream/43.9upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'meson/check-version.py')
-rwxr-xr-xmeson/check-version.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/meson/check-version.py b/meson/check-version.py
new file mode 100755
index 0000000..81750c9
--- /dev/null
+++ b/meson/check-version.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import os, sys
+from pathlib import Path
+import argparse, subprocess
+
+def check_version(version, file, type='news'):
+ if type == 'news':
+ line = file.open().readline()
+ ok = line.startswith(version)
+ print("{}: {}".format(file, "OK" if ok else "FAILED"))
+ if not ok:
+ raise Exception("{} does not start with {}".format(file, version))
+ elif type == 'metainfo':
+ subprocess.run(['appstream-util', 'validate-version', file, version],
+ check=True)
+ else:
+ raise Exception('Not implemented')
+
+parser = argparse.ArgumentParser(description='Check release version information.')
+parser.add_argument('--type', choices=['metainfo','news'], default='news')
+parser.add_argument('version', help='the version to check for')
+parser.add_argument('files', nargs='+', help='files to check')
+args = parser.parse_args()
+
+distroot = os.environ.get('MESON_DIST_ROOT', './')
+
+try:
+ for file in args.files:
+ check_version(args.version, Path(distroot, file), args.type)
+except:
+ sys.exit(1)