composer: add provisional multi-arch support

The pipeline generation now takes the architecture as an argument.
Currently only x86_64 is supported. The architecture is detected
at start-up, and passed down to each pipeline translation.

For osbuild-pipeline we now requrie the architecture to be passed
in.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-12-10 03:10:10 +01:00 committed by Lars Karlitski
parent dcc9cdedee
commit d33fc5f010
11 changed files with 48 additions and 20 deletions

View file

@ -4,6 +4,7 @@ import (
"flag"
"log"
"os"
"runtime"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/jobqueue"
@ -14,6 +15,20 @@ import (
"github.com/coreos/go-systemd/activation"
)
func currentArch() string {
if runtime.GOARCH == "amd64" {
return "x86_64"
} else if runtime.GOARCH == "arm64" {
return "aarch64"
} else if runtime.GOARCH == "ppc64le" {
return "ppc64le"
} else if runtime.GOARCH == "s390x" {
return "s390x"
} else {
panic("unsupported architecture")
}
}
func main() {
var verbose bool
flag.BoolVar(&verbose, "v", false, "Print access log")
@ -48,7 +63,7 @@ func main() {
store := store.New(&stateDir, distribution)
jobAPI := jobqueue.New(logger, store)
weldrAPI := weldr.New(rpm, distribution, logger, store)
weldrAPI := weldr.New(rpm, currentArch(), distribution, logger, store)
go jobAPI.Serve(jobListener)
weldrAPI.Serve(weldrListener)

View file

@ -14,9 +14,11 @@ import (
func main() {
var format string
var blueprintArg string
var archArg string
var distroArg string
flag.StringVar(&format, "output-format", "qcow2", "output format")
flag.StringVar(&format, "output-format", "", "output format")
flag.StringVar(&blueprintArg, "blueprint", "", "blueprint to translate")
flag.StringVar(&archArg, "arch", "", "architecture to create image for")
flag.StringVar(&distroArg, "distro", "", "distribution to create")
flag.Parse()
@ -55,7 +57,7 @@ func main() {
panic(err.Error())
}
pipeline, err := d.Pipeline(blueprint, checksums, format)
pipeline, err := d.Pipeline(blueprint, checksums, archArg, format)
if err != nil {
panic(err.Error())
}