include the version that pack is running on for filtering the build gen metadata

This commit is contained in:
mike seiler 2023-02-16 14:01:45 -07:00
parent ea03e1b6e7
commit 0f6cbf1be2
3 changed files with 22 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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")