Created
January 29, 2021 10:25
-
-
Save gicmo/61f599abdea01cd1bf296bf78dd91271 to your computer and use it in GitHub Desktop.
Resolve package list for osbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Usr/bin/python3 | |
import json | |
import os | |
import sys | |
from urllib.parse import urlparse | |
def main(): | |
with open(sys.argv[1], "r") as f: | |
data = json.load(f) | |
files = data["sources"]["org.osbuild.files"]["urls"] | |
stages = data["pipeline"]["stages"] | |
for stage in stages: | |
if stage["name"] == "org.osbuild.rpm": | |
break | |
assert stage["name"] == "org.osbuild.rpm" | |
packages = stage["options"]["packages"] | |
urls = [files[c["checksum"]]["url"] for c in packages] | |
paths = [urlparse(u).path for u in urls] | |
names = [os.path.basename(p) for p in paths] | |
for name in sorted(names): | |
print(name) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment