forked from suse-edge/Factory
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com> (cherry picked from commitd6d501ad99) (cherry picked from commit4d824b71cc) (cherry picked from commit0d3c83fca1) (cherry picked from commit5a73d61002) (cherry picked from commit34687fb5e9) (cherry picked from commit4a99805fde) (cherry picked from commit331f08255c) (cherry picked from commit3dea69443d) (cherry picked from commitd97e434fce) (cherry picked from commit9e41ee25d9) (cherry picked from commit8f20b3433e)
62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
import argparse
|
|
|
|
from jinja2 import Template
|
|
from common import PROJECT
|
|
|
|
def render(base_project, subproject, internal, scm_url=None):
|
|
version = base_project.rsplit(':', 1)[-1]
|
|
context = {
|
|
"base_project": subproject == "",
|
|
"title": f"SUSE Edge {version} {subproject}".rstrip(),
|
|
}
|
|
if subproject == "ToTest":
|
|
context["project"] = f"{base_project}:ToTest"
|
|
context["description"] = (
|
|
f"This project doesn't build, it stores a snapshot of SUSE Edge {version} "
|
|
"project currently going through the automated test layer"
|
|
)
|
|
if "Factory" in base_project or internal:
|
|
context["release_project"] = f"{base_project}:Snapshot"
|
|
elif subproject == "Snapshot":
|
|
context["project"] = f"{base_project}:Snapshot"
|
|
context["release_project"] = f"{base_project.rsplit(':', 1)[0]}:Containers"
|
|
context["for_release"] = True
|
|
context["description"] = (
|
|
f"This project doesn't build, it stores a snapshot of SUSE Edge {version} "
|
|
"project that passed automated test layer"
|
|
)
|
|
elif subproject == "":
|
|
context["project"] = base_project
|
|
context["release_project"] = f"{base_project}:ToTest"
|
|
else: # PR case direct python call
|
|
context["base_project"] = True
|
|
context["project"] = f"{base_project}:{subproject}"
|
|
if scm_url is not None:
|
|
context["scm_url"] = scm_url
|
|
|
|
with open("_meta") as meta:
|
|
template = Template(meta.read())
|
|
return template.render(context)
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
prog='ProgramName',
|
|
description='What the program does',
|
|
epilog='Text at the bottom of help')
|
|
parser.add_argument("subproject", default="", choices=["", "ToTest", "Snapshot"], nargs="?")
|
|
parser.add_argument("--internal", action="store_true")
|
|
parser.add_argument("--pr")
|
|
parser.add_argument("--scm-url")
|
|
args = parser.parse_args()
|
|
base_project = PROJECT.replace("isv", "ISV", 1) if args.internal else PROJECT
|
|
|
|
print(render(
|
|
base_project=base_project,
|
|
subproject=args.subproject if args.pr is None else f"Staging:PR-{args.pr}",
|
|
internal=args.internal,
|
|
scm_url=args.scm_url,
|
|
))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |