From 96eb609f6eb9558e2fab491a2c63a11bb0556471 Mon Sep 17 00:00:00 2001 From: Laura Peskin Date: Wed, 3 Jul 2024 14:15:53 -0700 Subject: pkg/build: add build command for starnix Co-authored-by: eep@google.com --- pkg/vcs/fuchsia.go | 11 +++++++---- pkg/vcs/vcs.go | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'pkg/vcs') diff --git a/pkg/vcs/fuchsia.go b/pkg/vcs/fuchsia.go index dfe4dc597..c2704c8ea 100644 --- a/pkg/vcs/fuchsia.go +++ b/pkg/vcs/fuchsia.go @@ -24,9 +24,12 @@ func newFuchsia(dir string, opts []RepoOpt) *fuchsia { } func (ctx *fuchsia) Poll(repo, branch string) (*Commit, error) { - if repo != "https://fuchsia.googlesource.com" || branch != "master" { - // Fuchsia ecosystem is hard-wired to the main repo. - return nil, fmt.Errorf("fuchsia: can only check out https://fuchsia.googlesource.com/master") + if repo != "https://fuchsia.googlesource.com/fuchsia" || (branch != "main" && branch != "master") { + // Fuchsia ecosystem is hard-wired to the main repo + branch. + // The 'master' branch is a mirror of 'main'. + return nil, fmt.Errorf( + "fuchsia: can only check out 'main' or 'master' branch of https://fuchsia.googlesource.com/fuchsia", + ) } if _, err := runSandboxed(ctx.dir, "./.jiri_root/bin/jiri", "update"); err != nil { if err := ctx.initRepo(); err != nil { @@ -48,7 +51,7 @@ func (ctx *fuchsia) initRepo() error { if err := osutil.SandboxChown(tmpDir); err != nil { return err } - cmd := "curl -s 'https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT' |" + + cmd := "curl -s 'https://fuchsia.googlesource.com/fuchsia/+/main/scripts/bootstrap?format=TEXT' |" + "base64 --decode | bash" if _, err := runSandboxed(tmpDir, "bash", "-c", cmd); err != nil { return err diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index 17f54d653..cb32a4071 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -197,6 +197,9 @@ const ( func NewRepo(os, vmType, dir string, opts ...RepoOpt) (Repo, error) { switch os { case targets.Linux: + if vmType == targets.Starnix { + return newFuchsia(dir, opts), nil + } return newLinux(dir, opts, vmType), nil case targets.Fuchsia: return newFuchsia(dir, opts), nil -- cgit mrf-deployment