-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
external: split out the depsolve external
This splits out the depsolve external along the lines of the previously written partition externals. Using the external is now a two-step process where you run one external in a define and then use its output to generate stages and sources. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
- Loading branch information
Showing
6 changed files
with
150 additions
and
123 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"""`otk-osbuild` is the [otk](https://github.com/osbuild/otk) external to work | ||
with [osbuild](https://github.com/osbuild/osbuild) manifests. | ||
THIS FILE IS VERY, VERY PROOF OF CONCEPT AND NEEDS TO BE CLEANED UP""" | ||
|
||
import json | ||
import subprocess | ||
import sys | ||
|
||
|
||
def root(): | ||
data = json.loads(sys.stdin.read()) | ||
|
||
tree = data["tree"] | ||
|
||
request = { | ||
"command": "depsolve", | ||
"arch": tree["architecture"], | ||
"module_platform_id": "platform:" + tree["module_platform_id"], | ||
"releasever": tree["releasever"], | ||
"cachedir": "/tmp", | ||
"arguments": { | ||
"root_dir": "/tmp", | ||
"repos": tree["repositories"], | ||
"transactions": [ | ||
{ | ||
"package-specs": tree["packages"]["include"], | ||
"exclude-specs": tree["packages"].get("exclude", []), | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
process = subprocess.run( | ||
["/usr/libexec/osbuild-depsolve-dnf"], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
input=json.dumps(request), | ||
encoding="utf8", | ||
check=False, | ||
) | ||
|
||
if process.returncode != 0: | ||
# TODO: fix this | ||
raise RuntimeError( | ||
process.stderr | ||
) # pylint: disable=broad-exception-raised | ||
|
||
results = json.loads(process.stdout) | ||
packages = results.get("packages", []) | ||
|
||
sys.stdout.write( | ||
json.dumps( | ||
{ | ||
"tree": packages, | ||
}, | ||
), | ||
) | ||
|
||
|
||
def main(): | ||
root() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
36 changes: 36 additions & 0 deletions
36
src/otk_external_osbuild/command/depsolve_dnf4_gen_curl_source.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""`otk-osbuild` is the [otk](https://github.com/osbuild/otk) external to work | ||
with [osbuild](https://github.com/osbuild/osbuild) manifests. | ||
THIS FILE IS VERY, VERY PROOF OF CONCEPT AND NEEDS TO BE CLEANED UP""" | ||
|
||
import itertools | ||
import json | ||
import sys | ||
|
||
|
||
def root(): | ||
data = json.load(sys.stdin) | ||
tree = data["tree"] | ||
|
||
sources = {"org.osbuild.curl": {"items": {}}} | ||
|
||
for package in itertools.chain.from_iterable(tree["packages"]): | ||
sources["org.osbuild.curl"]["items"][package["checksum"]] = { | ||
"url": package["remote_location"], | ||
} | ||
|
||
sys.stdout.write( | ||
json.dumps( | ||
{ | ||
"tree": sources, | ||
} | ||
) | ||
) | ||
|
||
|
||
def main(): | ||
root() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
45 changes: 45 additions & 0 deletions
45
src/otk_external_osbuild/command/depsolve_dnf4_gen_rpm_stage.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""`otk-osbuild` is the [otk](https://github.com/osbuild/otk) external to work | ||
with [osbuild](https://github.com/osbuild/osbuild) manifests. | ||
THIS FILE IS VERY, VERY PROOF OF CONCEPT AND NEEDS TO BE CLEANED UP""" | ||
|
||
import json | ||
import sys | ||
|
||
|
||
def root(): | ||
data = json.load(sys.stdin) | ||
tree = data["tree"] | ||
|
||
sys.stdout.write( | ||
json.dumps( | ||
{ | ||
"tree": { | ||
"type": "org.osbuild.rpm", | ||
"inputs": { | ||
"origin": "org.osbuild.source", | ||
"references": [ | ||
{ | ||
"id": package["checksum"], | ||
"options": { | ||
"metadata": {"rpm.check_gpg": True} | ||
}, | ||
} | ||
for package in tree["packages"] | ||
], | ||
}, | ||
"options": { | ||
"gpgkeys": tree["gpgkeys"], | ||
}, | ||
} | ||
} | ||
) | ||
) | ||
|
||
|
||
def main(): | ||
root() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |