Skip to content

Commit d02abd2

Browse files
mvo5supakeen
authored andcommitted
distro: add distro.ImageOptions.Bootc.InstallerPayloadRef
Moving the installer payload ref for bootc into the image options is a much nicer place than the previous way of having it as part `BootcDistro`. The alternative would be to make it part of `BootcAnacondaInstaller`. This would imply an explicit cast in all frontends so it seems this is preferable (and similar to how ostree commits are configured).
1 parent 9ef3330 commit d02abd2

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

cmd/gen-manifests/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,6 @@ func main() {
650650
panic(err)
651651
}
652652
}
653-
if fakeBootcCnt.PayloadContainerRef != "" {
654-
if err := distribution.SetInstallerPayload(fakeBootcCnt.PayloadContainerRef); err != nil {
655-
panic(err)
656-
}
657-
}
658653

659654
imgType, err := archi.GetImageType(imgTypeName)
660655
if err != nil {
@@ -673,6 +668,11 @@ func main() {
673668
fmt.Printf("Skipping %s for %s/%s (reason: %v)\n", itConfig.Name, imgTypeName, distribution.Name(), reason)
674669
continue
675670
}
671+
if fakeBootcCnt.PayloadContainerRef != "" {
672+
itConfig.Options.Bootc = &distro.BootcImageOptions{
673+
InstallerPayloadRef: fakeBootcCnt.PayloadContainerRef,
674+
}
675+
}
676676

677677
var repos []rpmmd.RepoConfig
678678
job := makeManifestJob(itConfig, imgType, distribution, repos, archName, cacheRoot, outputDir, contentResolve, metadata, tmpdirRoot)

pkg/distro/bootc/bootc.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ import (
3131
var _ = distro.Distro(&BootcDistro{})
3232

3333
type BootcDistro struct {
34-
imgref string
35-
buildImgref string
36-
// XXX: wrong place?
37-
payloadRef string
34+
imgref string
35+
buildImgref string
3836
sourceInfo *osinfo.Info
3937
buildSourceInfo *osinfo.Info
4038

@@ -85,12 +83,6 @@ func (d *BootcDistro) SetBuildContainer(imgref string) (err error) {
8583
return d.setBuildContainer(imgref, info)
8684
}
8785

88-
// XXX: wrong layer
89-
func (d *BootcDistro) SetInstallerPayload(imgref string) error {
90-
d.payloadRef = imgref
91-
return nil
92-
}
93-
9486
func (d *BootcDistro) setBuildContainer(imgref string, info *osinfo.Info) error {
9587
d.buildImgref = imgref
9688
d.buildSourceInfo = info

pkg/distro/bootc/iso.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ func (t *BootcAnacondaInstaller) Manifest(bp *blueprint.Blueprint, options distr
110110
if t.arch.distro.imgref == "" {
111111
return nil, nil, fmt.Errorf("internal error: no base image defined")
112112
}
113+
if options.Bootc == nil || options.Bootc.InstallerPayloadRef == "" {
114+
return nil, nil, fmt.Errorf("no installer payload bootc ref set")
115+
}
116+
payloadRef := options.Bootc.InstallerPayloadRef
117+
113118
containerSource := container.SourceSpec{
114119
Source: t.arch.distro.imgref,
115120
Name: t.arch.distro.imgref,
@@ -153,8 +158,8 @@ func (t *BootcAnacondaInstaller) Manifest(bp *blueprint.Blueprint, options distr
153158
img.InitramfsPath = fmt.Sprintf("lib/modules/%s/initramfs.img", t.arch.distro.sourceInfo.KernelInfo.Version)
154159
img.InstallerHome = "/var/roothome"
155160
payloadSource := container.SourceSpec{
156-
Source: t.arch.distro.payloadRef,
157-
Name: t.arch.distro.payloadRef,
161+
Source: payloadRef,
162+
Name: payloadRef,
158163
Local: true,
159164
}
160165
img.InstallerPayload = payloadSource

pkg/distro/distro.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,15 @@ type ImageType interface {
135135
Manifest(bp *blueprint.Blueprint, options ImageOptions, repos []rpmmd.RepoConfig, seed *int64) (*manifest.Manifest, []string, error)
136136
}
137137

138+
type BootcImageOptions struct {
139+
InstallerPayloadRef string `json:"installer_payload_ref,omitempty"`
140+
}
141+
138142
// The ImageOptions specify options for a specific image build
139143
type ImageOptions struct {
140144
Size uint64 `json:"size"`
141145
OSTree *ostree.ImageOptions `json:"ostree,omitempty"`
146+
Bootc *BootcImageOptions `json:"bootc,omitempty"`
142147
Subscription *subscription.ImageOptions `json:"subscription,omitempty"`
143148
Facts *facts.ImageOptions `json:"facts,omitempty"`
144149
PartitioningMode partition.PartitioningMode `json:"partitioning-mode,omitempty"`

0 commit comments

Comments
 (0)