From 0f6cbf1be25aa2d255051fcdc0b2e1d280910174 Mon Sep 17 00:00:00 2001 From: mike seiler Date: Thu, 16 Feb 2023 14:01:45 -0700 Subject: [PATCH] include the version that pack is running on for filtering the build gen metadata --- Makefile | 2 +- build/actors/pack.sh | 2 +- gen/bundle/bundle.go | 30 ++++++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 385ea3482..d1e7d159a 100644 --- a/Makefile +++ b/Makefile @@ -298,7 +298,7 @@ actors-gen: actors-code-gen fiximports .PHONY: actors-gen bundle-gen: - $(GOCC) run ./gen/bundle $(RELEASE) $(RELEASE_OVERRIDES) + $(GOCC) run ./gen/bundle $(VERSION) $(RELEASE) $(RELEASE_OVERRIDES) $(GOCC) fmt ./build/... .PHONY: bundle-gen diff --git a/build/actors/pack.sh b/build/actors/pack.sh index b8d2bdb3d..e594bb2da 100755 --- a/build/actors/pack.sh +++ b/build/actors/pack.sh @@ -52,4 +52,4 @@ popd echo "Generating metadata..." -make -C ../../ RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen +make -C ../../ VERSION="$VERSION" RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen diff --git a/gen/bundle/bundle.go b/gen/bundle/bundle.go index 908ef57e8..a1eab4e04 100644 --- a/gen/bundle/bundle.go +++ b/gen/bundle/bundle.go @@ -45,24 +45,34 @@ func main() { panic(err) } + var metadataSpecificVersion []*build.BuiltinActorsMetadata + // see ./build/actors/pack.sh // expected args are git bundle tag then number of per network overrides // overrides are in the format network_name=override - overrides := map[string]string{} - for _, override := range os.Args[2:] { - network, version := splitOverride(override) - overrides[network] = version - } if len(os.Args) > 1 { + version := os.Args[1] + overrides := map[string]string{} + for _, override := range os.Args[3:] { + k, v := splitOverride(override) + overrides[k] = v + } for _, m := range metadata { - override, ok := overrides[m.Network] - if ok && strings.HasPrefix(override, fmt.Sprintf("v%d", m.Version)) { - m.BundleGitTag = override - } else { - m.BundleGitTag = os.Args[1] + if strings.HasPrefix(version, fmt.Sprintf("v%d", m.Version)) { + // correct version + override, ok := overrides[m.Network] + if ok { + m.BundleGitTag = override + } else { + m.BundleGitTag = os.Args[2] + } + fmt.Println("hi") + metadataSpecificVersion = append(metadataSpecificVersion, m) } } + metadata = metadataSpecificVersion + } fi, err := os.Create("./build/builtin_actors_gen.go")