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.
This commit is contained in:
parent
ba32f58ac8
commit
8c4ee795f7
4 changed files with 25 additions and 3 deletions
|
|
@ -16,6 +16,10 @@ import (
|
|||
)
|
||||
|
||||
type Distro interface {
|
||||
// Returns the name of the distro. This is the same name that was
|
||||
// passed to New().
|
||||
Name() string
|
||||
|
||||
// Returns a list of repositories from which this distribution gets its
|
||||
// content.
|
||||
Repositories(arch string) []rpmmd.RepoConfig
|
||||
|
|
@ -40,8 +44,8 @@ var registered map[string]Distro
|
|||
|
||||
func init() {
|
||||
registered = map[string]Distro{
|
||||
"fedora-30": fedora30.New(),
|
||||
"rhel-8.2": rhel82.New(),
|
||||
fedora30.Name: fedora30.New(),
|
||||
rhel82.Name: rhel82.New(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ type output struct {
|
|||
Assembler func(uefi bool) *pipeline.Assembler
|
||||
}
|
||||
|
||||
const Name = "fedora-30"
|
||||
|
||||
func New() *Fedora30 {
|
||||
r := Fedora30{
|
||||
arches: map[string]arch{},
|
||||
|
|
@ -240,6 +242,10 @@ func New() *Fedora30 {
|
|||
return &r
|
||||
}
|
||||
|
||||
func (r *Fedora30) Name() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (r *Fedora30) Repositories(arch string) []rpmmd.RepoConfig {
|
||||
return []rpmmd.RepoConfig{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ type output struct {
|
|||
Assembler func(uefi bool) *pipeline.Assembler
|
||||
}
|
||||
|
||||
const Name = "rhel-8.2"
|
||||
|
||||
func New() *RHEL82 {
|
||||
const GigaByte = 1024 * 1024 * 1024
|
||||
|
||||
|
|
@ -392,6 +394,10 @@ func New() *RHEL82 {
|
|||
return &r
|
||||
}
|
||||
|
||||
func (r *RHEL82) Name() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (r *RHEL82) Repositories(arch string) []rpmmd.RepoConfig {
|
||||
return []rpmmd.RepoConfig{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,8 +11,14 @@ import (
|
|||
|
||||
type TestDistro struct{}
|
||||
|
||||
const Name = "test"
|
||||
|
||||
func init() {
|
||||
distro.Register("test", &TestDistro{})
|
||||
distro.Register(Name, &TestDistro{})
|
||||
}
|
||||
|
||||
func (d *TestDistro) Name() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
func (d *TestDistro) Repositories(arch string) []rpmmd.RepoConfig {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue