support network name overrides in pack to build releases

This commit is contained in:
mike seiler 2023-02-16 10:33:47 -07:00
parent f427c2b566
commit 3e678f2abc
3 changed files with 27 additions and 9 deletions

View File

@ -298,7 +298,7 @@ actors-gen: actors-code-gen fiximports
.PHONY: actors-gen .PHONY: actors-gen
bundle-gen: bundle-gen:
$(GOCC) run ./gen/bundle $(RELEASE) $(GOCC) run ./gen/bundle $(RELEASE) $(RELEASE_OVERRIDES)
$(GOCC) fmt ./build/... $(GOCC) fmt ./build/...
.PHONY: bundle-gen .PHONY: bundle-gen

View File

@ -52,4 +52,4 @@ popd
echo "Generating metadata..." echo "Generating metadata..."
make -C ../../ RELEASE="$RELEASE" bundle-gen make -C ../../ RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen

View File

@ -2,6 +2,7 @@ package main
import ( import (
"os" "os"
"strings"
"text/template" "text/template"
"github.com/filecoin-project/lotus/build" "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() { func main() {
metadata, err := build.ReadEmbeddedBuiltinActorsMetadata() metadata, err := build.ReadEmbeddedBuiltinActorsMetadata()
if err != nil { if err != nil {
panic(err) panic(err)
} }
// TODO: Re-enable this when we can set the tag for ONLY the appropriate version // see ./build/actors/pack.sh
// https://github.com/filecoin-project/lotus/issues/10185#issuecomment-1422864836 // expected args are git bundle tag then number of per network overrides
//if len(os.Args) > 1 { // overrides are in the format network_name=override
// for _, m := range metadata { overrides := map[string]string{}
// m.BundleGitTag = os.Args[1] 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") fi, err := os.Create("./build/builtin_actors_gen.go")
if err != nil { if err != nil {