Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 14 additions & 53 deletions pkg/distro/generic/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,7 @@ func diskImage(t *imageType,
containers []container.SourceSpec,
rng *rand.Rand) (image.ImageKind, error) {

img := image.NewDiskImage()
img.Platform = t.platform
img := image.NewDiskImage(t.platform, t.Filename())

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
Expand All @@ -470,8 +469,6 @@ func diskImage(t *imageType,
}
img.PartitionTable = pt

img.Filename = t.Filename()

img.VPCForceSize = t.ImageTypeYAML.DiskImageVPCForceSize

if img.OSCustomizations.NoBLS {
Expand All @@ -494,9 +491,7 @@ func tarImage(t *imageType,
payloadRepos []rpmmd.RepoConfig,
containers []container.SourceSpec,
rng *rand.Rand) (image.ImageKind, error) {
img := image.NewArchive()

img.Platform = t.platform
img := image.NewArchive(t.platform, t.Filename())

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
Expand All @@ -511,8 +506,6 @@ func tarImage(t *imageType,
img.Compression = t.ImageTypeYAML.Compression
img.OSVersion = d.OsVersion()

img.Filename = t.Filename()

return img, nil
}

Expand All @@ -523,9 +516,7 @@ func containerImage(t *imageType,
payloadRepos []rpmmd.RepoConfig,
containers []container.SourceSpec,
rng *rand.Rand) (image.ImageKind, error) {
img := image.NewBaseContainer()

img.Platform = t.platform
img := image.NewBaseContainer(t.platform, t.Filename())

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
Expand All @@ -535,8 +526,6 @@ func containerImage(t *imageType,
img.OSCustomizations.PayloadRepos = payloadRepos
img.Environment = &t.ImageTypeYAML.Environment

img.Filename = t.Filename()

return img, nil
}

Expand All @@ -548,9 +537,8 @@ func liveInstallerImage(t *imageType,
containers []container.SourceSpec,
rng *rand.Rand) (image.ImageKind, error) {

img := image.NewAnacondaLiveInstaller()
img := image.NewAnacondaLiveInstaller(t.platform, t.Filename())

img.Platform = t.platform
img.ExtraBasePackages = packageSets[installerPkgsKey]
d := t.arch.distro

Expand All @@ -566,8 +554,6 @@ func liveInstallerImage(t *imageType,
return nil, err
}

img.Filename = t.Filename()

imgConfig := t.getDefaultImageConfig()
if locale := imgConfig.Locale; locale != nil {
img.Locale = *locale
Expand All @@ -592,7 +578,7 @@ func imageInstallerImage(t *imageType,

customizations := bp.Customizations

img := image.NewAnacondaTarInstaller()
img := image.NewAnacondaTarInstaller(t.platform, t.Filename())

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
Expand All @@ -609,8 +595,6 @@ func imageInstallerImage(t *imageType,
img.Kickstart.Keyboard = img.OSCustomizations.Keyboard
img.Kickstart.Timezone = &img.OSCustomizations.Timezone

img.Platform = t.platform

img.ExtraBasePackages = packageSets[installerPkgsKey]

img.InstallerCustomizations, err = installerCustomizations(t, bp.Customizations)
Expand Down Expand Up @@ -645,8 +629,6 @@ func imageInstallerImage(t *imageType,
return nil, err
}

img.Filename = t.Filename()

img.RootfsCompression = "xz" // This also triggers using the bcj filter

return img, nil
Expand All @@ -661,12 +643,10 @@ func iotCommitImage(t *imageType,
rng *rand.Rand) (image.ImageKind, error) {

parentCommit, commitRef := makeOSTreeParentCommit(options.OSTree, t.OSTreeRef())
img := image.NewOSTreeArchive(commitRef)
img := image.NewOSTreeArchive(t.platform, t.Filename(), commitRef)

d := t.arch.distro

img.Platform = t.platform

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
if err != nil {
Expand All @@ -683,7 +663,6 @@ func iotCommitImage(t *imageType,
img.Environment = &t.ImageTypeYAML.Environment
img.OSTreeParent = parentCommit
img.OSVersion = d.OsVersion()
img.Filename = t.Filename()

return img, nil
}
Expand All @@ -697,12 +676,10 @@ func bootableContainerImage(t *imageType,
rng *rand.Rand) (image.ImageKind, error) {

parentCommit, commitRef := makeOSTreeParentCommit(options.OSTree, t.OSTreeRef())
img := image.NewOSTreeArchive(commitRef)
img := image.NewOSTreeArchive(t.platform, t.Filename(), commitRef)

d := t.arch.distro

img.Platform = t.platform

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
if err != nil {
Expand All @@ -713,7 +690,6 @@ func bootableContainerImage(t *imageType,
img.Environment = &t.ImageTypeYAML.Environment
img.OSTreeParent = parentCommit
img.OSVersion = d.OsVersion()
img.Filename = t.Filename()
img.InstallWeakDeps = false
img.BootContainer = true
id, err := distro.ParseID(d.Name())
Expand All @@ -737,9 +713,8 @@ func iotContainerImage(t *imageType,
rng *rand.Rand) (image.ImageKind, error) {

parentCommit, commitRef := makeOSTreeParentCommit(options.OSTree, t.OSTreeRef())
img := image.NewOSTreeContainer(commitRef)
img := image.NewOSTreeContainer(t.platform, t.Filename(), commitRef)
d := t.arch.distro
img.Platform = t.platform

var err error
img.OSCustomizations, err = osCustomizations(t, packageSets[osPkgsKey], options, containers, bp)
Expand All @@ -759,7 +734,6 @@ func iotContainerImage(t *imageType,
img.OSTreeParent = parentCommit
img.OSVersion = d.OsVersion()
img.ExtraContainerPackages = packageSets[containerPkgsKey]
img.Filename = t.Filename()

return img, nil
}
Expand All @@ -779,10 +753,9 @@ func iotInstallerImage(t *imageType,
return nil, fmt.Errorf("%s: %s", t.Name(), err.Error())
}

img := image.NewAnacondaOSTreeInstaller(commit)
img := image.NewAnacondaOSTreeInstaller(t.platform, t.Filename(), commit)

customizations := bp.Customizations
img.Platform = t.platform
img.ExtraBasePackages = packageSets[installerPkgsKey]
img.Kickstart, err = kickstart.New(customizations)
if err != nil {
Expand Down Expand Up @@ -822,8 +795,6 @@ func iotInstallerImage(t *imageType,
return nil, err
}

img.Filename = t.Filename()

img.RootfsCompression = "xz" // This also triggers using the bcj filter
imgConfig := t.getDefaultImageConfig()
if locale := imgConfig.Locale; locale != nil {
Expand All @@ -845,7 +816,7 @@ func iotImage(t *imageType,
if err != nil {
return nil, fmt.Errorf("%s: %s", t.Name(), err.Error())
}
img := image.NewOSTreeDiskImageFromCommit(commit)
img := image.NewOSTreeDiskImageFromCommit(t.platform, t.Filename(), commit)

customizations := bp.Customizations
deploymentConfig, err := ostreeDeploymentCustomizations(t, customizations)
Expand All @@ -855,8 +826,6 @@ func iotImage(t *imageType,
img.OSTreeDeploymentCustomizations = deploymentConfig
img.OSCustomizations.PayloadRepos = payloadRepos

img.Platform = t.platform

img.Remote = ostree.Remote{
Name: t.ImageTypeYAML.OSTree.RemoteName,
}
Expand All @@ -875,7 +844,6 @@ func iotImage(t *imageType,
}
img.PartitionTable = pt

img.Filename = t.Filename()
img.Compression = t.ImageTypeYAML.Compression

return img, nil
Expand All @@ -893,7 +861,7 @@ func iotSimplifiedInstallerImage(t *imageType,
if err != nil {
return nil, fmt.Errorf("%s: %s", t.Name(), err.Error())
}
rawImg := image.NewOSTreeDiskImageFromCommit(commit)
rawImg := image.NewOSTreeDiskImageFromCommit(t.platform, t.Filename(), commit)

customizations := bp.Customizations
deploymentConfig, err := ostreeDeploymentCustomizations(t, customizations)
Expand All @@ -902,7 +870,6 @@ func iotSimplifiedInstallerImage(t *imageType,
}
rawImg.OSTreeDeploymentCustomizations = deploymentConfig

rawImg.Platform = t.platform
rawImg.OSCustomizations.PayloadRepos = payloadRepos
rawImg.Remote = ostree.Remote{
Name: t.OSTree.RemoteName,
Expand All @@ -920,12 +887,9 @@ func iotSimplifiedInstallerImage(t *imageType,
}
rawImg.PartitionTable = pt

rawImg.Filename = t.Filename()

img := image.NewOSTreeSimplifiedInstaller(rawImg, customizations.InstallationDevice)
// XXX: can we take platform/filename in NewOSTreeSimplifiedInstaller from rawImg instead?
img := image.NewOSTreeSimplifiedInstaller(t.platform, t.Filename(), rawImg, customizations.InstallationDevice)
img.ExtraBasePackages = packageSets[installerPkgsKey]
img.Platform = t.platform
img.Filename = t.Filename()
if bpFDO := customizations.GetFDO(); bpFDO != nil {
img.FDO = fdo.FromBP(*bpFDO)
}
Expand Down Expand Up @@ -975,13 +939,12 @@ func netinstImage(t *imageType,

customizations := bp.Customizations

img := image.NewAnacondaNetInstaller()
img := image.NewAnacondaNetInstaller(t.platform, t.Filename())
language, _ := customizations.GetPrimaryLocale()
if language != nil {
img.Language = *language
}

img.Platform = t.platform
img.ExtraBasePackages = packageSets[installerPkgsKey]

var err error
Expand All @@ -1005,8 +968,6 @@ func netinstImage(t *imageType,
return nil, err
}

img.Filename = t.Filename()

img.RootfsCompression = "xz" // This also triggers using the bcj filter

return img, nil
Expand Down
18 changes: 8 additions & 10 deletions pkg/image/anaconda_container_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

type AnacondaContainerInstaller struct {
Base
Platform platform.Platform

InstallerCustomizations manifest.InstallerCustomizations
ExtraBasePackages rpmmd.PackageSet

Expand All @@ -37,8 +37,6 @@ type AnacondaContainerInstaller struct {
ContainerSource container.SourceSpec
ContainerRemoveSignatures bool

Filename string

Kickstart *kickstart.Options

// Locale for the installer. This should be set to the same locale as the
Expand All @@ -49,9 +47,9 @@ type AnacondaContainerInstaller struct {
InstallRootfsType disk.FSType
}

func NewAnacondaContainerInstaller(container container.SourceSpec, ref string) *AnacondaContainerInstaller {
func NewAnacondaContainerInstaller(platform platform.Platform, filename string, container container.SourceSpec, ref string) *AnacondaContainerInstaller {
return &AnacondaContainerInstaller{
Base: NewBase("container-installer"),
Base: NewBase("container-installer", platform, filename),
ContainerSource: container,
Ref: ref,
}
Expand All @@ -67,7 +65,7 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest,
anacondaPipeline := manifest.NewAnacondaInstaller(
manifest.AnacondaInstallerTypePayload,
buildPipeline,
img.Platform,
img.platform,
repos,
"kernel",
img.Product,
Expand All @@ -79,7 +77,7 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest,
anacondaPipeline.ExcludePackages = img.ExtraBasePackages.Exclude
anacondaPipeline.ExtraRepos = img.ExtraBasePackages.Repositories
anacondaPipeline.Variant = img.Variant
anacondaPipeline.Biosdevname = (img.Platform.GetArch() == arch.ARCH_X86_64)
anacondaPipeline.Biosdevname = (img.platform.GetArch() == arch.ARCH_X86_64)
anacondaPipeline.Checkpoint()
anacondaPipeline.InstallerCustomizations = img.InstallerCustomizations

Expand All @@ -101,8 +99,8 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest,
}

bootTreePipeline := manifest.NewEFIBootTree(buildPipeline, img.Product, img.OSVersion)
bootTreePipeline.Platform = img.Platform
bootTreePipeline.UEFIVendor = img.Platform.GetUEFIVendor()
bootTreePipeline.Platform = img.platform
bootTreePipeline.UEFIVendor = img.platform.GetUEFIVendor()
bootTreePipeline.ISOLabel = img.ISOLabel

if img.Kickstart == nil {
Expand Down Expand Up @@ -138,7 +136,7 @@ func (img *AnacondaContainerInstaller) InstantiateManifest(m *manifest.Manifest,
isoTreePipeline.InstallRootfsType = img.InstallRootfsType

isoPipeline := manifest.NewISO(buildPipeline, isoTreePipeline, img.ISOLabel)
isoPipeline.SetFilename(img.Filename)
isoPipeline.SetFilename(img.filename)
isoPipeline.ISOBoot = img.InstallerCustomizations.ISOBoot
artifact := isoPipeline.Export()

Expand Down
Loading
Loading