debian-forge-composer/internal/distro/test/distro.go
Lars Karlitski d3a0b788a2 distro: set the repository checksum dynamically
Instead of having a static repository checksum, set it dynamically from
the metadata that osbuild-composer last saw. This is implemented in
dnf-json, which returns the checksums for each repository on every call.

This enables the use of repositories that change over time, such as
fedora-updates. Note that the osbuild pipeline will break when such a
repository changes. This is intentional: pipelines have to be
reproducible.
2019-12-10 20:38:22 +01:00

42 lines
1 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{}
func init() {
distro.Register("test", &TestDistro{})
}
func (d *TestDistro) Repositories() []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, checksums map[string]string, outputFormat string) (*pipeline.Pipeline, error) {
return nil, errors.New("invalid output format: " + outputFormat)
}
func (d *TestDistro) Runner() string {
return "org.osbuild.test"
}