distro: don't use a global variable to store the distro register

Introduce a DistroRegister object. For now this does not introduce
any functional changes, as the object is always instantited to be
the same. However, in follow-up patches it will get options.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-12-19 13:47:07 +01:00
parent 6c49560479
commit 5fcdd4bea5
11 changed files with 59 additions and 40 deletions

View file

@ -49,8 +49,9 @@ func main() {
jobListener := listeners[1]
rpm := rpmmd.NewRPMMD()
distros := distro.NewRegistry()
distribution, err := distro.FromHost()
distribution, err := distros.FromHost()
if err != nil {
log.Fatalf("Could not determine distro from host: " + err.Error())
}

View file

@ -34,7 +34,8 @@ func main() {
}
}
d := distro.New(distroArg)
distros := distro.NewRegistry()
d := distros.GetDistro(distroArg)
if d == nil {
panic("unknown distro: " + distroArg)
}