Introduce the `distro` package, which contains an interface for OS implementations. Its main purpose is to convert a blueprint to a distro-specific pipeline. Also introduce the `distro/fedora30` package. It is the first implementation of the distro interface. Most of its code has been copied with minimal modifications from the blueprint package. The `blueprint` package is now back to serving a single purpose: representing a weldr blueprint. It does not depend on the `pipeline` package anymore. Change osbuild-composer and osbuild-pipeline to use the new API, hard-coding "fedora-30". This looks a bit weird now, but is the same behavior as before. All test cases now also take an "distro" key in the "compose" object.
44 lines
946 B
Go
44 lines
946 B
Go
package fedora30
|
|
|
|
import (
|
|
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
|
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
|
)
|
|
|
|
type tarOutput struct{}
|
|
|
|
func (t *tarOutput) translate(b *blueprint.Blueprint) (*pipeline.Pipeline, error) {
|
|
packages := [...]string{
|
|
"policycoreutils",
|
|
"selinux-policy-targeted",
|
|
"kernel",
|
|
"firewalld",
|
|
"chrony",
|
|
"langpacks-en",
|
|
}
|
|
excludedPackages := [...]string{
|
|
"dracut-config-rescue",
|
|
}
|
|
p := getCustomF30PackageSet(packages[:], excludedPackages[:], b)
|
|
addF30LocaleStage(p)
|
|
addF30GRUB2Stage(p, b.GetKernelCustomization())
|
|
addF30FixBlsStage(p)
|
|
addF30SELinuxStage(p)
|
|
addF30TarAssembler(p, t.getName(), "xz")
|
|
|
|
if b.Customizations != nil {
|
|
err := customizeAll(p, b.Customizations)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return p, nil
|
|
}
|
|
|
|
func (t *tarOutput) getName() string {
|
|
return "root.tar.xz"
|
|
}
|
|
|
|
func (t *tarOutput) getMime() string {
|
|
return "application/x-tar"
|
|
}
|