tests: move from dnf- to rpm-based pipelines
This should produce the same images (except for no more dnf metadata),
but avoids depsolving (and network access) from stages.
The following helper script around osbuild-composer's dnf-json was
used for the translation:
```
import json
import os
import subprocess
import sys
def fetch_repos(sources, repo):
if isinstance(repo, str):
repo = sources["org.osbuild.dnf"]["repos"][repo]
return repo, repo["gpgkey"]
def convert_stage(sources, stage, cachedir):
gpgkeys = []
repos = []
for repoid, repo in enumerate(stage["options"]["repos"]):
repo, gpgkey = fetch_repos(sources, repo)
repo["id"] = repoid
repo["name"] = f"repo-{repoid}"
repos.append(repo)
gpgkeys.append(gpgkey)
arguments = {}
arguments["cachedir"] = cachedir
arguments["module_platform_id"] = stage["options"]["module_platform_id"]
arguments["package-specs"] = stage["options"]["packages"]
arguments["exclude-specs"] = stage["options"].get("exclude_packages", [])
arguments["repos"] = repos
call = {}
call["command"] = "depsolve"
call["arguments"] = arguments
r = subprocess.run(["./dnf-json"],
input=json.dumps(call),
stdout=subprocess.PIPE,
encoding="utf-8",
check=True)
pkgs = json.loads(r.stdout)["dependencies"]
packages = []
urls = {}
for p in pkgs:
packages.append(p["checksum"])
urls[p["checksum"]] = p["remote_location"]
options = {}
options["gpgkeys"] = gpgkeys
options["packages"] = packages
stage["name"] = "org.osbuild.rpm"
stage["options"] = options
return urls
def convert_pipeline(sources, pipeline, cachedir):
urls = {}
if "build" in pipeline:
u = convert_pipeline(sources, pipeline["build"]["pipeline"], cachedir)
urls = {**urls, **u}
for stage in pipeline["stages"]:
if stage["name"] == "org.osbuild.dnf":
u = convert_stage(sources, stage, cachedir)
urls = {**urls, **u}
return urls
manifest = json.load(sys.stdin)
urls = convert_pipeline(manifest["sources"], manifest["pipeline"], f"{os.getcwd()}/dnf-cache")
sources = { "org.osbuild.files": { "urls": urls }}
json.dump({"sources": sources, "pipeline": manifest["pipeline"]}, sys.stdout)
75,9 Bot
```
Signed-off-by: Tom Gundersen <teg@jklm.no>