diff --git a/Makefile b/Makefile index 023ca61f5..385ea3482 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) + $(GOCC) run ./gen/bundle $(RELEASE) $(RELEASE_OVERRIDES) $(GOCC) fmt ./build/... .PHONY: bundle-gen diff --git a/build/actors/pack.sh b/build/actors/pack.sh index 863a3c5c7..b8d2bdb3d 100755 --- a/build/actors/pack.sh +++ b/build/actors/pack.sh @@ -52,4 +52,4 @@ popd echo "Generating metadata..." -make -C ../../ RELEASE="$RELEASE" bundle-gen +make -C ../../ RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen diff --git a/gen/bundle/bundle.go b/gen/bundle/bundle.go index d953b99c9..da38f192f 100644 --- a/gen/bundle/bundle.go +++ b/gen/bundle/bundle.go @@ -2,6 +2,7 @@ package main import ( "os" + "strings" "text/template" "github.com/filecoin-project/lotus/build" @@ -32,19 +33,36 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet } `)) +func splitOverride(override string) (string, string) { + x := strings.Split(override, "=") + return x[0], x[1] +} + func main() { metadata, err := build.ReadEmbeddedBuiltinActorsMetadata() if err != nil { panic(err) } - // TODO: Re-enable this when we can set the tag for ONLY the appropriate version - // https://github.com/filecoin-project/lotus/issues/10185#issuecomment-1422864836 - //if len(os.Args) > 1 { - // for _, m := range metadata { - // m.BundleGitTag = os.Args[1] - // } - //} + // 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 { + for _, m := range metadata { + override, ok := overrides[m.Network] + if ok { + m.BundleGitTag = override + } else { + m.BundleGitTag = os.Args[1] + } + } + } fi, err := os.Create("./build/builtin_actors_gen.go") if err != nil {