1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-04 23:24:21 +00:00
os-autoinst-distri-fedora/ostree-parse-pungi.py
Adam Williamson ed58b15432 Update base platform version in ostree-parse-pungi.py
Why did I do this? Not sure. I guess I figured it's too much
trouble to get it updated on every pungi-fedora branch? Anyway.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-03-30 08:47:13 -07:00

49 lines
1.4 KiB
Python

#!/usr/bin/python
import re
import sys
# the "current" base platform version, i.e. the one that the GNOME
# app builds currently tagged "stable" need
BASEVER = "38"
# a regex to find where we replace that
BASEPATT = re.compile(r"(runtime/org.fedoraproject.Platform/.*?/f)(\d+)")
flavor = sys.argv[1]
arch = sys.argv[2]
started = 0
finished = 0
ostree = ""
with open("fedora.conf", "r") as conffh:
for line in conffh.readlines():
if line == "ostree_installer = [\n":
started = 1
if started and not finished:
ostree += line
if started and line == "]\n":
finished = 1
# don't do this at home, kids!
exec(ostree)
for (gotflav, dic) in ostree_installer:
if flavor in gotflav.lower():
args = dic[arch]
break
cmd = "--rootfs-size=" + args["rootfs_size"]
for addtemp in args["add_template"]:
cmd += f" --add-template=/fedora-lorax-templates/{addtemp}"
for addtempvar in args["add_template_var"]:
# this changes e.g. "runtime/org.fedoraproject.Platform/x86_64/f35"
# to "runtime/org.fedoraproject.Platform/x86_64/f37" , if BASEVER
# is "37"
addtempvar = BASEPATT.sub(r"\g<1>" + BASEVER, addtempvar)
cmd += f" --add-template-var=\"{addtempvar}\""
# this is where the previous step of the openQA test created the
# ostree repo
cmd = cmd.replace("https://kojipkgs.fedoraproject.org/compose/ostree/repo/", "file:///var/tmp/ostree/repo")
print(cmd)