distro: expose default OSTreeRef()

Rather than setting this automagically, expose it to the caller. For
now the only caller we have simply passes it back in, so this is a
noop.

In follow-up commits this will be used to resolve the parent commit.

This is tested by verifying that the generated manifests do not
change.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2021-02-17 18:56:23 +00:00 committed by Ondřej Budai
parent 3c74ea584e
commit 6cb47862df
9 changed files with 55 additions and 20 deletions

View file

@ -18,6 +18,7 @@ import (
const name = "fedora-33"
const modulePlatformID = "platform:f33"
const ostreeRef = "fedora/33/%s/iot"
type distribution struct {
arches map[string]architecture
@ -146,6 +147,13 @@ func (t *imageType) MIMEType() string {
return t.mimeType
}
func (t *imageType) OSTreeRef() string {
if t.rpmOstree {
return fmt.Sprintf(ostreeRef, t.arch.name)
}
return ""
}
func (t *imageType) Size(size uint64) uint64 {
const MegaByte = 1024 * 1024
// Microsoft Azure requires vhd images to be rounded up to the nearest MB
@ -525,13 +533,9 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
}
func ostreeCommitAssembler(options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler {
ref := options.OSTree.Ref
if ref == "" {
ref = fmt.Sprintf("fedora/33/%s/iot", arch.Name())
}
return osbuild.NewOSTreeCommitAssembler(
&osbuild.OSTreeCommitAssemblerOptions{
Ref: ref,
Ref: options.OSTree.Ref,
Parent: options.OSTree.Parent,
Tar: osbuild.OSTreeCommitAssemblerTarOptions{
Filename: "commit.tar",