weldr: Use host distro name from registry list
The name of the distro you get from distros.FromHost() may not match any of the names in the registry's list. Use the actual name of the distro instead of the mangled name. Also removes api.distro which is unused.
This commit is contained in:
parent
1aa5d49696
commit
963ce1d050
1 changed files with 3 additions and 5 deletions
|
|
@ -47,7 +47,6 @@ type API struct {
|
|||
|
||||
rpmmd rpmmd.RPMMD
|
||||
arch distro.Arch
|
||||
distro distro.Distro
|
||||
repoRegistry *reporegistry.RepoRegistry
|
||||
|
||||
logger *log.Logger
|
||||
|
|
@ -110,7 +109,6 @@ func NewTestAPI(rpm rpmmd.RPMMD, arch distro.Arch, dr *distroregistry.Registry,
|
|||
workers: workers,
|
||||
rpmmd: rpm,
|
||||
arch: arch,
|
||||
distro: hostDistro,
|
||||
repoRegistry: rr,
|
||||
logger: logger,
|
||||
compatOutputDir: compatOutputDir,
|
||||
|
|
@ -122,12 +120,13 @@ func NewTestAPI(rpm rpmmd.RPMMD, arch distro.Arch, dr *distroregistry.Registry,
|
|||
|
||||
func New(repoPaths []string, stateDir string, rpm rpmmd.RPMMD, distros *distroregistry.Registry, logger *log.Logger, workers *worker.Server) (*API, error) {
|
||||
|
||||
hostDistro := distros.FromHost()
|
||||
if hostDistro == nil {
|
||||
hostDistroName, _, _, err := distro.GetHostDistroName()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("host distro is not supported")
|
||||
}
|
||||
archName := common.CurrentArch()
|
||||
|
||||
hostDistro := distros.GetDistro(hostDistroName)
|
||||
hostArch, err := hostDistro.GetArch(archName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Host distro does not support host architecture: %v", err)
|
||||
|
|
@ -152,7 +151,6 @@ func New(repoPaths []string, stateDir string, rpm rpmmd.RPMMD, distros *distrore
|
|||
workers: workers,
|
||||
rpmmd: rpm,
|
||||
arch: hostArch,
|
||||
distro: hostDistro,
|
||||
repoRegistry: rr,
|
||||
logger: logger,
|
||||
compatOutputDir: compatOutputDir,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue