From fd8f65a9da0b9719a366d96cb8bc3ac001d816ac Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 3 Mar 2025 16:17:13 +0100 Subject: [PATCH] refactor: Simplify version parsing and add logging in PatchWheel --- libs/patchwheel/patchwheel.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/patchwheel/patchwheel.go b/libs/patchwheel/patchwheel.go index 167fd1103..390cdbf72 100644 --- a/libs/patchwheel/patchwheel.go +++ b/libs/patchwheel/patchwheel.go @@ -14,6 +14,8 @@ import ( "strconv" "strings" "time" + + "github.com/databricks/cli/libs/log" ) // readMetadataAndRecord scans the zip file for files matching the patterns @@ -55,9 +57,7 @@ func parseMetadata(content []byte) (version, distribution string, err error) { if strings.HasPrefix(line, versionKey) { v := strings.TrimSpace(strings.TrimPrefix(line, versionKey)) // If there's a '+' in the version, strip it off. - if strings.Contains(v, "+") { - v = strings.SplitN(v, "+", 2)[0] - } + v = strings.SplitN(v, "+", 2)[0] version = v } else if strings.HasPrefix(line, nameKey) { distribution = strings.TrimSpace(strings.TrimPrefix(line, nameKey)) @@ -155,6 +155,7 @@ func PatchWheel(path, outputDir string) (string, error) { } baseVersion, distribution, err := parseMetadata(metadataContent) + log.Infof(ctx, "path=%s baseVersion=%s distribution=%s err=%s", path, baseVersion, distribution) if err != nil { return "", err }