Files
rocm-systems/utils/ver_check.py
T

36 lines
896 B
Python
Raw Normal View History

2022-11-04 14:49:36 -05:00
#!/usr/bin/env python3
#
# Support utility to check VERSION file against a tagname. Used in
# release pipeline.
import argparse
2025-01-02 13:29:47 -08:00
from pathlib import Path
2022-11-04 14:49:36 -05:00
parser = argparse.ArgumentParser()
parser.add_argument("--tag", type=str, required=True, help="tagname to check")
args = parser.parse_args()
2025-01-02 13:29:47 -08:00
execPath = str(Path(__file__).parent)
2022-11-04 14:49:36 -05:00
with open(execPath + "/../VERSION") as f:
repoVer = f.readline().strip()
repoCheck = "v" + repoVer
tag = args.tag
print("Current repository version = %s" % repoVer)
print("--> tagname = %s" % tag)
if repoCheck == tag:
print("OK: exact match")
exit(0)
elif tag.startswith(repoCheck + "-"):
print("OK: allowed match with extra delimiter")
exit(0)
elif tag.startswith("rocm-"):
print("OK: allowed match with 'rocm-' prefix")
exit(0)
2022-11-04 14:49:36 -05:00
else:
print("FAIL: no match - double check top-level VERSION file")
exit(1)