From a68a9ce1d28cd2916c3036ba1ebad92509d1538d Mon Sep 17 00:00:00 2001 From: steebchen Date: Wed, 21 Jun 2023 22:53:53 +0100 Subject: [PATCH] fix alpine --- binaries/platform/platform.go | 4 ---- generator/run.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/binaries/platform/platform.go b/binaries/platform/platform.go index 3046c5d2..4249d32e 100644 --- a/binaries/platform/platform.go +++ b/binaries/platform/platform.go @@ -34,10 +34,6 @@ func BinaryPlatformNameDynamic() string { distro := getLinuxDistro() - if distro == "alpine" { - return fmt.Sprintf("linux-static-%s", arch) - } - ssl := getOpenSSL() name := fmt.Sprintf("%s-openssl-%s", distro, ssl) diff --git a/generator/run.go b/generator/run.go index ba4d99ec..1b90d081 100644 --- a/generator/run.go +++ b/generator/run.go @@ -180,6 +180,8 @@ func generateBinaries(input *Root) error { logger.Debug.Printf("swapping 'native' binary target with '%s'", name) } + name = TransformBinaryTarget(name) + // first, ensure they are actually downloaded if err := binaries.FetchEngine(binaries.GlobalCacheDir(), "query-engine", name); err != nil { return fmt.Errorf("failed fetching binaries: %w", err) @@ -204,6 +206,8 @@ func generateQueryEngineFiles(binaryTargets []string, pkg, outputDir string) err name = platform.BinaryPlatformNameStatic() } + name = TransformBinaryTarget(name) + enginePath := binaries.GetEnginePath(binaries.GlobalCacheDir(), "query-engine", name) filename := fmt.Sprintf("query-engine-%s_gen.go", name) @@ -228,3 +232,12 @@ func add(list []string, item string) []string { } return list } + +func TransformBinaryTarget(name string) string { + // TODO this is a temp fix as the exact alpine libraries are not working + if name == "linux" || strings.Contains(name, "musl") { + name = "linux-static-x64" + logger.Debug.Printf("overriding binary name with '%s' due to linux or musl", name) + } + return name +}