Skip to content

Commit

Permalink
bib: remove usage of BootcLegacyDiskImage (for qemu-9.1)
Browse files Browse the repository at this point in the history
This commit enables bib to work with the qemu-9.1+openat2 patches
as proposed in https://src.fedoraproject.org/rpms/qemu/pull-request/70.

With the qemu-user-statuc-aarch64 rpm produced by `fedpkg mockbuild`
from this package the cross-arch test build works again.
```
$ sudo PYTHONPATH=. pytest './test/test_build.py::test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch}),arm64]' -s -vv
============================= test session starts ==============================
platform linux -- Python 3.12.7, pytest-7.4.3, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/mvogt/devel/osbuild/bootc-image-builder
configfile: pytest.ini
plugins: repeat-0.9.3, xdist-3.5.0
collected 1 item

test/test_build.py::test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch}),arm64] [1/2] STEP 1/9: FROM registry.fedoraproject.org/fedora:40 AS builder
...
PASSEDChecking disk usage for /var/tmp/bib-tests/shared0/68b20145da2cd3f2/image/disk.raw
NOTE: disk usage after /var/tmp/bib-tests/shared0/68b20145da2cd3f2/image/disk.raw: 712472.71936 / 1998694.907904
Untagged: quay.io/centos-bootc/centos-bootc:stream9
Deleted: 0de1f90b11cbe7e2768101f6c55b4dd9841c13a2f87c8d9c177aea74ade88050

============================= slowest 10 durations =============================
1033.54s setup    test/test_build.py::test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch}),arm64]
67.62s call     test/test_build.py::test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch}),arm64]
2.30s teardown test/test_build.py::test_image_boots[quay.io/centos-bootc/centos-bootc:stream9,raw,CentOS Stream 9 ({arch}),arm64]
======================== 1 passed in 1103.58s (0:18:23) ========================
```
  • Loading branch information
mvo5 committed Nov 8, 2024
1 parent 48daa02 commit 9850e89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
14 changes: 3 additions & 11 deletions bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,11 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
mf.Distro = manifest.DISTRO_FEDORA
runner := &runner.Linux{}

// Remove the "NewBootcLegacyDiskImage" if part below and
// *only* use the "else" part of the code once either of the
// following is available in centos/rhel
// https://github.com/containers/bootc/pull/462
// https://www.mail-archive.com/[email protected]/msg1034508.html
if c.Architecture != arch.Current() {
legacyImg := image.NewBootcLegacyDiskImage(img)
err = legacyImg.InstantiateManifestFromContainers(&mf, []container.SourceSpec{containerSource}, runner, rng)
} else {
err = img.InstantiateManifestFromContainers(&mf, []container.SourceSpec{containerSource}, runner, rng)
if err := img.InstantiateManifestFromContainers(&mf, []container.SourceSpec{containerSource}, runner, rng); err != nil {
return nil, err
}

return &mf, err
return &mf, nil
}

func labelForISO(os *source.OSRelease, arch *arch.Arch) string {
Expand Down
7 changes: 2 additions & 5 deletions test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ def gen_testcases(what): # pylint: disable=too-many-return-statements
]
# do a cross arch test too
if platform.machine() == "x86_64":
# TODO: re-enable once
# https://github.com/osbuild/bootc-image-builder/issues/619
# is resolved
# test_cases.append(
# TestCaseCentos(image="raw", target_arch="arm64"))
test_cases.append(
TestCaseCentos(image="raw", target_arch="arm64"))
pass
elif platform.machine() == "arm64":
# TODO: add arm64->x86_64 cross build test too
Expand Down

0 comments on commit 9850e89

Please sign in to comment.