Skip to content

Commit 8c1f5da

Browse files
glpeska-nogikh
authored andcommitted
pkg/vcs: implement remaining Repo methods for fuchsia
This is a temporary workaround for managing a fuchsia checkout: - Mark the repo as "precious" so that checkout operations don't delete GN args and other build configuration state. In a follow-up, this will be replaced by a fuchsia-specific `repair` method using `fx clean`. - Checkout operations apply only to fuchsia.git, which has a chance of creating inconsistencies between versions of fuchsia and its dependencies. The main poll workflow (using `jiri`) is not affected by this problem, but bisection workflows may fail. This will be fixed in a follow-up by checking out branches and commits from fuchsia's global integration repo.
1 parent 7c3db81 commit 8c1f5da

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

pkg/vcs/fuchsia.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ import (
1111
"github.com/google/syzkaller/pkg/osutil"
1212
)
1313

14+
// TODO: Check out branches and commits from Fuchsia's global integration repo
15+
// rather than fuchsia.git.
1416
type fuchsia struct {
1517
dir string
1618
repo *git
1719
}
1820

1921
func newFuchsia(dir string, opts []RepoOpt) *fuchsia {
22+
// For now, don't clean up the Fuchsia repo when checking out new commits or branches.
23+
// Otherwise, subsequent builds will fail due to missing GN args and other build configuration.
24+
// TODO: Implement selective cleanup with `fx clean`.
25+
opts = append(opts, OptPrecious)
2026
return &fuchsia{
2127
dir: dir,
2228
repo: newGit(dir, nil, opts),
@@ -60,19 +66,19 @@ func (ctx *fuchsia) initRepo() error {
6066
}
6167

6268
func (ctx *fuchsia) CheckoutBranch(repo, branch string) (*Commit, error) {
63-
return nil, fmt.Errorf("not implemented for fuchsia: CheckoutBranch")
69+
return ctx.repo.CheckoutBranch(repo, branch)
6470
}
6571

6672
func (ctx *fuchsia) CheckoutCommit(repo, commit string) (*Commit, error) {
67-
return nil, fmt.Errorf("not implemented for fuchsia: CheckoutCommit")
73+
return ctx.repo.CheckoutCommit(repo, commit)
6874
}
6975

7076
func (ctx *fuchsia) SwitchCommit(commit string) (*Commit, error) {
71-
return nil, fmt.Errorf("not implemented for fuchsia: SwitchCommit")
77+
return ctx.repo.SwitchCommit(commit)
7278
}
7379

74-
func (ctx *fuchsia) Commit(com string) (*Commit, error) {
75-
return nil, fmt.Errorf("not implemented for fuchsia: Commit")
80+
func (ctx *fuchsia) Commit(commit string) (*Commit, error) {
81+
return ctx.repo.Commit(commit)
7682
}
7783

7884
func (ctx *fuchsia) GetCommitByTitle(title string) (*Commit, error) {
@@ -88,11 +94,11 @@ func (ctx *fuchsia) ExtractFixTagsFromCommits(baseCommit, email string) ([]*Comm
8894
}
8995

9096
func (ctx *fuchsia) ReleaseTag(commit string) (string, error) {
91-
return "", fmt.Errorf("not implemented for fuchsia: ReleaseTag")
97+
return ctx.repo.ReleaseTag(commit)
9298
}
9399

94100
func (ctx *fuchsia) Contains(commit string) (bool, error) {
95-
return false, fmt.Errorf("not implemented for fuchsia: Contains")
101+
return ctx.repo.Contains(commit)
96102
}
97103

98104
func (ctx *fuchsia) ListCommitHashes(base string) ([]string, error) {
@@ -107,10 +113,11 @@ func (ctx *fuchsia) MergeBases(firstCommit, secondCommit string) ([]*Commit, err
107113
return ctx.repo.MergeBases(firstCommit, secondCommit)
108114
}
109115

110-
func (ctx *fuchsia) CommitExists(string) (bool, error) {
111-
return false, fmt.Errorf("not implemented for fuchsia: CommitExists")
116+
func (ctx *fuchsia) CommitExists(commit string) (bool, error) {
117+
return ctx.repo.CommitExists(commit)
112118
}
113119

114120
func (ctx *fuchsia) PushCommit(repo, commit string) error {
121+
// Fuchsia repo doesn't accept unauthenticated pushes.
115122
return fmt.Errorf("not implemented for fuchsia: PushCommit")
116123
}

0 commit comments

Comments
 (0)