Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pack: support network name overrides in bundle git tags #10294

Merged
merged 7 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build/actors/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ popd

echo "Generating metadata..."

make -C ../../ RELEASE="$RELEASE" bundle-gen
make -C ../../ RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen
32 changes: 25 additions & 7 deletions gen/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"os"
"strings"
"text/template"

"github.com/filecoin-project/lotus/build"
Expand Down Expand Up @@ -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
snissn marked this conversation as resolved.
Show resolved Hide resolved
// 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 {
Expand Down