diff --git a/tools/autotag/util/__init__.py b/tools/autotag/util/__init__.py index bdfded03e..25be22a57 100755 --- a/tools/autotag/util/__init__.py +++ b/tools/autotag/util/__init__.py @@ -1,2 +1,2 @@ from .defaults import TEMPLATES, PROCESSORS -from .custom_templates import hipfort, mivisionx, rpp +from .custom_templates import hipfort, hipify, mivisionx, rpp, rvs diff --git a/tools/autotag/util/custom_templates/hipfort.py b/tools/autotag/util/custom_templates/hipfort.py index 65d6876f6..354e41b26 100644 --- a/tools/autotag/util/custom_templates/hipfort.py +++ b/tools/autotag/util/custom_templates/hipfort.py @@ -5,10 +5,10 @@ from util.defaults import TEMPLATES, PROCESSORS TEMPLATES['hipfort'] = ( ( - r"## hipfort (?P\d+\.\d+(?:\.\d+))?" - r"(?P for ROCm )?" - r"(?P(?(for_rocm)\d+\.\d+(?:\.\d+)?|.*))?" - r"( \(Unreleased\))?" + r"## hipfort" + r"(?: (?P\d+\.\d+(?:\.\d+))?)?" + r"(?: for ROCm (?P\d+\.\d+(?:\.\d+)?))?" + r"(?: \(Unreleased\))?" r"\n" r"(?P(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)" ) @@ -21,19 +21,20 @@ def hipfort_processor(data: ReleaseLib, template: str, _, __) -> bool: changelog = changelog.decoded_content.decode() pattern = re.compile(template) match = pattern.search(changelog) - lib_version = match["lib_version"] + lib_version = match["rocm_version"] + data.message = ( f"hipfort for ROCm" f" {data.full_version}" ) - - data.lib_version = lib_version data.notes = f"""{match["body"]}""" + data.lib_version = lib_version change_pattern = re.compile( r"^#+ +(?P[^\n]+)$\n*(?P(^(?!#).*\n*)*)", re.RegexFlag.MULTILINE ) + for match in change_pattern.finditer(data.notes): data.data.changes[match["type"]] = match["change"] diff --git a/tools/autotag/util/custom_templates/hipify.py b/tools/autotag/util/custom_templates/hipify.py new file mode 100644 index 000000000..57c9a2b12 --- /dev/null +++ b/tools/autotag/util/custom_templates/hipify.py @@ -0,0 +1,42 @@ +import re + +from util.release_data import ReleaseLib +from util.defaults import TEMPLATES, PROCESSORS + +TEMPLATES['HIPIFY'] = ( + ( + r"## HIPIFY" + r"(?: (?P\d+\.\d+(?:\.\d+))?)?" + r"(?: for ROCm (?P\d+\.\d+(?:\.\d+)?))?" + r"(?: ?\(Unreleased\))?" + r"\n" + r"(?P(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)" + ) +) + + +def hipify_processor(data: ReleaseLib, template: str, _, __) -> bool: + """Processor for releases.""" + changelog = data.repo.get_contents("CHANGELOG.md", data.commit) + changelog = changelog.decoded_content.decode() + pattern = re.compile(template) + match = pattern.search(changelog) + lib_version = match["rocm_version"] + + data.message = ( + f"HIPIFY for ROCm" + f" {data.full_version}" + ) + data.notes = f"""{match["body"]}""" + data.lib_version = lib_version + + change_pattern = re.compile( + r"^#+ +(?P[^\n]+)$\n*(?P(^(?!#).*\n*)*)", + re.RegexFlag.MULTILINE + ) + for match in change_pattern.finditer(data.notes): + data.data.changes[match["type"]] = match["change"] + + return True + +PROCESSORS['HIPIFY'] = hipify_processor diff --git a/tools/autotag/util/custom_templates/rvs.py b/tools/autotag/util/custom_templates/rvs.py new file mode 100644 index 000000000..52fc223d4 --- /dev/null +++ b/tools/autotag/util/custom_templates/rvs.py @@ -0,0 +1,42 @@ +import re + +from util.release_data import ReleaseLib +from util.defaults import TEMPLATES, PROCESSORS + +TEMPLATES['ROCmValidationSuite'] = ( + ( + r"## RVS" + r"(?: (?P\d+\.\d+(?:\.\d+))?)?" + r"(?: for ROCm (?P\d+\.\d+(?:\.\d+)?))?" + r"(?: ?\(Unreleased\))?" + r"\n" + r"(?P(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)" + ) +) + + +def rvs_processor(data: ReleaseLib, template: str, _, __) -> bool: + """Processor for releases.""" + changelog = data.repo.get_contents("CHANGELOG.md", data.commit) + changelog = changelog.decoded_content.decode() + pattern = re.compile(template) + match = pattern.search(changelog) + lib_version = match["rocm_version"] + + data.message = ( + f"RVS for ROCm" + f" {data.full_version}" + ) + data.lib_version = lib_version + data.notes = f"""{match["body"]}""" + + change_pattern = re.compile( + r"^#+ +(?P[^\n]+)$\n*(?P(^(?!#).*\n*)*)", + re.RegexFlag.MULTILINE + ) + for match in change_pattern.finditer(data.notes): + data.data.changes[match["type"]] = match["change"] + + return True + +PROCESSORS['ROCmValidationSuite'] = rvs_processor