1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-21 21:43:08 +00:00
os-autoinst-distri-fedora/ostree-parse-pungi.py
Adam Williamson d07b5a4178 Tweak ostree build and rebase for update tests to be more robust
We have had several problems where rebasing from one release to
another just doesn't work, and we have to work around it somehow.
Sometimes it's difficult or impossible to do. All we want to do
here is check the rebase mechanism itself; we don't actually want
to assert that you can rebase to any specific other release.

For update tests, we should be able to use a non-standard ref
name for the ostree we build, embed into the installer image,
and install. That should mean we can then rebase to the standard
ref name for the same release, which should be much safer than
trying to rebase to a different release. We can't do this for
the compose tests, but at least for update tests I'm hoping this
makes things more robust.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-06-11 21:06:57 -07:00

52 lines
1.6 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")
# this changes to our custom ref name
cmd = cmd.replace("ostree_install_ref=fedora/", "ostree_install_ref=fedora-openqa/")
cmd = cmd.replace("ostree_update_ref=fedora/", "ostree_update_ref=fedora-openqa/")
print(cmd)