From 8433a06b18c660d50ff14a5ba73e85eee0649454 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 29 Oct 2021 20:21:08 +0200 Subject: [PATCH 1/3] Fix YAML syntax --- chromium-coreboot.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/chromium-coreboot.yaml b/chromium-coreboot.yaml index 868c00f..216cb33 100644 --- a/chromium-coreboot.yaml +++ b/chromium-coreboot.yaml @@ -10,23 +10,23 @@ sites: branch: chromeos-2016.05 authentication: cookie cookieName: o - cookieValue: {somefunnystring} + cookieValue: "{somefunnystring}" workstreams: main: neverModify: - util/crossgcc/ - 3rdparty/ - util/nvidia/cbootimage/ - .checkpatch.conf - .gitmodules - OWNERS + - util/crossgcc/ + - 3rdparty/ + - util/nvidia/cbootimage/ + - .checkpatch.conf + - .gitmodules + - OWNERS coreboot-sdk: onlyIfTouching: - util/crossgcc/ + - util/crossgcc/ neverModify: - 3rdparty/ - util/nvidia/cbootimage/ - .checkpatch.conf - .gitmodules - OWNERS + - 3rdparty/ + - util/nvidia/cbootimage/ + - .checkpatch.conf + - .gitmodules + - OWNERS From 65c9d16717137e9be84deaefab096c3a18b8a992 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 29 Oct 2021 20:21:25 +0200 Subject: [PATCH 2/3] Add initial code Enough to read and dump the config file --- gerritcp.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 5 +++++ go.sum | 3 +++ 3 files changed, 58 insertions(+) create mode 100644 gerritcp.go create mode 100644 go.mod create mode 100644 go.sum diff --git a/gerritcp.go b/gerritcp.go new file mode 100644 index 0000000..9a501ca --- /dev/null +++ b/gerritcp.go @@ -0,0 +1,50 @@ +package main + +import ( + "flag" + "fmt" + "os" + + "gopkg.in/yaml.v2" +) + +type Repo struct { + Url string `yaml:"url"` + Repo string `yaml:"repo"` + Branch string `yaml:"branch"` + Authentication string `yaml:"authentication"` + CookieName string `yaml:"cookieName"` + CookieValue string `yaml:"cookieValue"` +} + +type Workstreams struct { + OnlyIfTouching []string `yaml:"onlyIfTouching"` + NeverModify []string `yaml:"neverModify"` +} + +type configFormat struct { + Sites map[string]Repo `yaml:"sites"` + Workstreams map[string]Workstreams `yaml:"workstreams"` +} + +func main() { + // dir := flag.String("dir", "repo", "path to local git repo") + configFile := flag.String("config", "config.yaml", "path to configuration") + flag.Parse() + + file, err := os.Open(*configFile) + if err != nil { + panic(fmt.Sprintf("Could not open '%s': %s", *configFile, err)) + } + defer file.Close() + + config := new(configFormat) + + configDecoder := yaml.NewDecoder(file) + err = configDecoder.Decode(&config) + if err != nil { + panic(fmt.Sprintf("Failed parsing '%s': %s", *configFile, err)) + } + + fmt.Println(config) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c640a00 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module review.coreboot.org/gerritcp/v2 + +go 1.17 + +require gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..7534661 --- /dev/null +++ b/go.sum @@ -0,0 +1,3 @@ +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From a922c08eda87d65db4ca60e57a8a87ab6860d2c0 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 29 Oct 2021 20:21:34 +0200 Subject: [PATCH 3/3] git-ignore the created executable --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..993c3d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +gerritcp \ No newline at end of file