Skip to content

Instantly share code, notes, and snippets.

@achilleas-k
Created December 1, 2021 11:09
Show Gist options
  • Save achilleas-k/1c8abdfca76268e91427c77962ba859b to your computer and use it in GitHub Desktop.
Save achilleas-k/1c8abdfca76268e91427c77962ba859b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import json
import sys
def main():
fname = sys.argv[1]
with open(fname, encoding="utf-8") as manifest_file:
manifest = json.load(manifest_file)
sources = manifest["sources"]["org.osbuild.curl"]["items"]
pipeline_pkgs = {}
for pipeline in manifest["pipelines"]:
for stage in pipeline["stages"]:
if stage["type"] == "org.osbuild.rpm":
pkg_names = []
for pkg_id in stage["inputs"]["packages"]["references"]:
pkg = sources[pkg_id]
if isinstance(pkg, dict):
pkg = pkg["url"]
pkg_names.append(pkg.split("/")[-1])
pipeline_pkgs[pipeline["name"]] = sorted(pkg_names)
for pl_name, pl_pkgs in pipeline_pkgs.items():
print(pl_name)
print(" " + "\n ".join(pl_pkgs))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment