public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Adam Williamson <awilliam@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/image-builder] rawhide: Backport PR #2542 to fix distro detection
Date: Tue, 21 Jul 2026 21:51:29 GMT [thread overview]
Message-ID: <178467068994.1.16404368526801574070.rpms-image-builder-e12bd9c50abe@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/image-builder
Branch : rawhide
Commit : e12bd9c50abefd0d75ce17f7aee77eb9819e9a5c
Author : Adam Williamson <awilliam@redhat.com>
Date : 2026-07-21T14:51:16-07:00
Stats : +122/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/image-builder/c/e12bd9c50abefd0d75ce17f7aee77eb9819e9a5c?branch=rawhide
Log:
Backport PR #2542 to fix distro detection
---
diff --git a/2542.patch b/2542.patch
new file mode 100644
index 0000000..31073b4
--- /dev/null
+++ b/2542.patch
@@ -0,0 +1,114 @@
+From 8008d1202653520db1fbff62e80456d36e8b9e57 Mon Sep 17 00:00:00 2001
+From: Simon de Vlieger <cmdr@supakeen.com>
+Date: Tue, 21 Jul 2026 22:14:14 +0200
+Subject: [PATCH 1/2] image-builder: test distro detection
+
+This is a failing test for the problem introduced in
+40c680562189265f544680864b98a736e6b2855d. The `getImage` function does
+not try to detect the host distribution when `distroStr` is empty.
+
+Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
+---
+ cmd/image-builder/main_test.go | 40 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/cmd/image-builder/main_test.go b/cmd/image-builder/main_test.go
+index 446c5e7b06..78d52338b7 100644
+--- a/cmd/image-builder/main_test.go
++++ b/cmd/image-builder/main_test.go
+@@ -224,6 +224,46 @@ func TestManifestIntegrationSmoke(t *testing.T) {
+ }
+ }
+
++func TestManifestIntegrationAutoDetectDistro(t *testing.T) {
++ restore := main.MockManifestgenDepsolver(fakeDepsolve)
++ defer restore()
++
++ restore = main.MockManifestgenContainerResolver(fakeContainerResolver)
++ defer restore()
++
++ restore = main.MockNewRepoRegistry(testrepos.New)
++ defer restore()
++
++ restore = main.MockDistroGetHostDistroName(func() (string, error) {
++ return "centos-9", nil
++ })
++ defer restore()
++
++ restore = main.MockOsArgs([]string{
++ "manifest",
++ "qcow2",
++ "--arch=x86_64",
++ fmt.Sprintf("--blueprint=%s", makeTestBlueprint(t, testBlueprint)),
++ })
++ defer restore()
++
++ var fakeStdout bytes.Buffer
++ restore = main.MockOsStdout(&fakeStdout)
++ defer restore()
++
++ var fakeStderr bytes.Buffer
++ restore = main.MockOsStderr(&fakeStderr)
++ defer restore()
++
++ err := main.Run()
++ require.NoError(t, err)
++
++ pipelineNames, err := manifesttest.PipelineNamesFrom(fakeStdout.Bytes())
++ require.NoError(t, err)
++ assert.Contains(t, pipelineNames, "qcow2")
++ assert.Contains(t, fakeStderr.String(), `No distro name specified, selecting "centos-9" based on host`)
++}
++
+ func TestManifestIntegrationCrossArch(t *testing.T) {
+ if testing.Short() {
+ t.Skip("manifest generation takes a while")
+
+From 39123edbeaaea34469549d4b349226c08a213c1c Mon Sep 17 00:00:00 2001
+From: Simon de Vlieger <cmdr@supakeen.com>
+Date: Tue, 21 Jul 2026 22:20:02 +0200
+Subject: [PATCH 2/2] image-builder: fallback to host distro in getImage
+
+This introduces a bit of duplication but fixes a critical bug where
+distribution detection was not performed when no distro is passed to the
+`build` or `describe` subcommands.
+
+The duplication can be unified later. See previous commit for the test
+case for this behavior.
+
+See this [1] bug for more details.
+
+[1]: https://github.com/osbuild/image-builder/issues/2541
+
+Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
+---
+ cmd/image-builder/main.go | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go
+index 94d25104c4..8b15555f99 100644
+--- a/cmd/image-builder/main.go
++++ b/cmd/image-builder/main.go
+@@ -349,6 +349,22 @@ func getImage(cmd *cobra.Command, args []string) (*imagefilter.Result, error) {
+ }
+ img = &imagefilter.Result{ImgType: imgType, Repos: nil}
+ } else {
++ var bpDistroName string
++ blueprintPath, err := cmd.Flags().GetString("blueprint")
++ if err != nil {
++ return nil, err
++ }
++ if blueprintPath != "" {
++ bp, err := blueprintload.Load(blueprintPath)
++ if err != nil {
++ return nil, err
++ }
++ bpDistroName = bp.Distro
++ }
++ distroStr, err = findDistro(distroStr, bpDistroName)
++ if err != nil {
++ return nil, err
++ }
+ repoOpts := &repoOptions{
+ RepoDir: repoDir,
+ ExtraRepos: extraRepos,
diff --git a/image-builder.spec b/image-builder.spec
index 8663c17..1f1c03a 100644
--- a/image-builder.spec
+++ b/image-builder.spec
@@ -23,6 +23,10 @@ License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND CC-BY-SA-4.0 AN
URL: %{gourl}
Source0: https://github.com/osbuild/image-builder/releases/download/v%{version}/image-builder-%{version}.tar.gz
+# Fix distro detection
+# https://github.com/osbuild/image-builder/pull/2542
+Patch: 2542.patch
+
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
BuildRequires: libvirt-devel
@@ -240,7 +244,7 @@ Requires: osbuild-depsolve-dnf >= %{min_osbuild_version}
%if 0%{?rhel}
%forgeautosetup -p1
%else
-%goprep -k
+%goprep -k -p1
%endif
%build
@@ -303,6 +307,9 @@ cd $PWD/_build/src/%{goipath}
%ghost %attr(0755, root, root) %dir /var/cache/image-builder
%changelog
+* Tue Jul 21 2026 Adam Williamson <awilliam@redhat.com> - 75.0.0-2
+- Backport PR #2542 to fix distro detection
+
* Tue Jul 21 2026 Packit <hello@packit.dev> - 75.0.0-1
Changes with 75.0.0
----------------
reply other threads:[~2026-07-21 21:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178467068994.1.16404368526801574070.rpms-image-builder-e12bd9c50abe@fedoraproject.org \
--to=awilliam@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox