weldr: pin a real Arch object, rather than a string

weldr needs to know the host architecture. Rather than pinning
a string, pin a real Arch object, and query its name when we
need it.

This verifies the validitiy of the architecture for the given
distro before it is passed to weldr, rather than lazily on
demand.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-22 20:42:23 +01:00 committed by msehnout
parent bbd8dc338d
commit f201fc84b7
4 changed files with 24 additions and 11 deletions

View file

@ -100,6 +100,11 @@ func main() {
log.Fatalf("Could not determine distro from host: " + err.Error())
}
arch, err := distribution.GetArch(common.CurrentArch())
if err != nil {
log.Fatalf("Host distro does not support host architecture: " + err.Error())
}
repoMap, err := rpmmd.LoadRepositories([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"}, distribution.Name())
if err != nil {
log.Fatalf("Could not load repositories for %s: %v", distribution.Name(), err)
@ -113,7 +118,7 @@ func main() {
store := store.New(&stateDir)
jobAPI := jobqueue.New(logger, store)
weldrAPI := weldr.New(rpm, common.CurrentArch(), distribution, repoMap[common.CurrentArch()], logger, store)
weldrAPI := weldr.New(rpm, arch, distribution, repoMap[common.CurrentArch()], logger, store)
go func() {
err := jobAPI.Serve(jobListener)