mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-04-06 18:36:50 +00:00
fix(flutter): include arch in rawcache tag to prevent collisions
Flutter's API returns separate entries for universal (x64) and arm64 macOS builds under the same version/channel/os. The rawcache tag was version-channel-os, so arm64 overwrote universal. Now extracts arch from the archive path and appends it to the tag. Re-fetched flutter: +218 entries recovered.
This commit is contained in:
@@ -400,8 +400,24 @@ func fetchFlutter(ctx context.Context, client *http.Client, cacheRoot, pkgName s
|
||||
return fmt.Errorf("flutterdist: %w", err)
|
||||
}
|
||||
for _, rel := range batch {
|
||||
// Use version+channel+os as the tag to distinguish per-OS entries.
|
||||
// Use version+channel+os+arch as the tag. The arch is embedded
|
||||
// in the archive path (e.g. flutter_macos_arm64_3.0.0-stable.zip
|
||||
// vs flutter_macos_3.0.0-stable.zip for universal/x64).
|
||||
arch := ""
|
||||
base := filepath.Base(rel.Archive)
|
||||
prefix := "flutter_" + rel.OS + "_"
|
||||
if after, ok := strings.CutPrefix(base, prefix); ok {
|
||||
if !strings.HasPrefix(after, rel.Version) {
|
||||
// There's an arch segment between OS and version.
|
||||
if idx := strings.Index(after, "_"); idx > 0 {
|
||||
arch = after[:idx]
|
||||
}
|
||||
}
|
||||
}
|
||||
tag := fmt.Sprintf("%s-%s-%s", rel.Version, rel.Channel, rel.OS)
|
||||
if arch != "" {
|
||||
tag += "-" + arch
|
||||
}
|
||||
data, err := json.Marshal(rel)
|
||||
if err != nil {
|
||||
return fmt.Errorf("flutterdist marshal %s: %w", tag, err)
|
||||
|
||||
Reference in New Issue
Block a user