debian-forge-composer/internal/distro/test/distro.go
Lars Karlitski 8c4ee795f7 distro: add Distro.Name()
Right now, there is no way to get at the name from a Distro instance.
We will need this to include the distro's name in the job we pass to the
worker, for instance.
2019-12-15 22:05:31 +01:00

48 lines
1.2 KiB
Go

package test
import (
"errors"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/pipeline"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
type TestDistro struct{}
const Name = "test"
func init() {
distro.Register(Name, &TestDistro{})
}
func (d *TestDistro) Name() string {
return Name
}
func (d *TestDistro) Repositories(arch string) []rpmmd.RepoConfig {
return []rpmmd.RepoConfig{
{
Id: "test",
Name: "Test",
BaseURL: "http://example.com/test/os",
},
}
}
func (d *TestDistro) ListOutputFormats() []string {
return []string{}
}
func (d *TestDistro) FilenameFromType(outputFormat string) (string, string, error) {
return "", "", errors.New("invalid output format: " + outputFormat)
}
func (d *TestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string) (*pipeline.Pipeline, error) {
return nil, errors.New("invalid output format or arch: " + outputFormat + " @ " + outputArch)
}
func (d *TestDistro) Runner() string {
return "org.osbuild.test"
}