Skip to content

Commit

Permalink
gen_depsolve_dnf4: include version/release/arch for kernel
Browse files Browse the repository at this point in the history
The `grub2` fragment require the release/version/arch of the kernel
package. Add them to the external so that they can be used inside
otk files.

Also tweak the mocks to follow
osbuild/images#937
so that we have predictable but non-empty version/release numbers.
  • Loading branch information
mvo5 committed Sep 16, 2024
1 parent 5f378bb commit 715eedf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/otk_external_osbuild/command/gen_depsolve_dnf4.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def transform(tree: dict, packages: List[dict]) -> dict:
data["tree"]["const"]["kernel"] = {
"name": kernel_pkg["name"],
"version": kernel_pkg["version"],
"release": kernel_pkg["release"],
"arch": kernel_pkg["arch"],
}

return data
Expand All @@ -47,7 +49,10 @@ def mockdata(packages):
"name": p,
"checksum": "sha256:" + hashlib.sha256(p.encode()).hexdigest(),
"remote_location": f"https://example.com/repo/packages/{p}",
"version": "",
# see https://github.com/osbuild/images/pull/937
"version": f"{ord(p[0]) % 9}",
"release": f"r{ord(p[1]) % 9}",
"arch": "noarch",
}
for p in packages
]
Expand Down
12 changes: 8 additions & 4 deletions test/test_gen_depsolve_dnf4.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_otk_under_test_mock_data(monkeypatch, capsys):
"checksum": "sha256:3d7b91c2dd3273400f26d21a492fcdfdc3dde228cd5627247dfef745ce717755",
"name": "pkg1",
"remote_location": "https://example.com/repo/packages/pkg1",
"version": "",
"version": "4",
"release": "r8",
},
],
},
Expand All @@ -50,21 +51,24 @@ def test_otk_under_test_mock_data_kernel(monkeypatch, capsys):
"const": {
"kernel": {
"name": "my-kernel",
"version": "",
"version": "1",
"release": "r4",
},
"internal": {
"packages": [
{
"checksum": "sha256:c892f5086e0951a7b31364bfd1373c375b10567a26e6e37ff96de2993428bc12",
"name": "my-kernel",
"remote_location": "https://example.com/repo/packages/my-kernel",
"version": "",
"version": "1",
"release": "r4",
},
{
"checksum": "sha256:3d7b91c2dd3273400f26d21a492fcdfdc3dde228cd5627247dfef745ce717755",
"name": "pkg1",
"remote_location": "https://example.com/repo/packages/pkg1",
"version": "",
"version": "4",
"release": "r8",
},
],
},
Expand Down

0 comments on commit 715eedf

Please sign in to comment.