From ac4dd5a9ec6a5138887004439c5dd73a39e5b3b5 Mon Sep 17 00:00:00 2001 From: dann frazier Date: Fri, 3 Jan 2025 11:36:23 -0700 Subject: [PATCH 1/2] Use DefaultWorkspaceDir from container instead of hardcoding "/home/build" Signed-off-by: dann frazier --- pkg/config/config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index b0f4287c0..643e83b53 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -39,6 +39,7 @@ import ( "github.com/joho/godotenv" "gopkg.in/yaml.v3" + "chainguard.dev/melange/pkg/container" "chainguard.dev/melange/pkg/util" ) @@ -1378,8 +1379,8 @@ func ParseConfiguration(_ context.Context, configurationFilePath string, opts .. } const ( - defaultEnvVarHOME = "/home/build" - defaultEnvVarGOPATH = "/home/build/.cache/go" + defaultEnvVarHOME = container.DefaultWorkspaceDir + defaultEnvVarGOPATH = container.DefaultWorkspaceDir + "/.cache/go" defaultEnvVarGOMODCACHE = "/var/cache/melange/gomodcache" ) From 554a08369048a09e068cdfdc6fcf9612925a78dc Mon Sep 17 00:00:00 2001 From: dann frazier Date: Fri, 3 Jan 2025 11:37:28 -0700 Subject: [PATCH 2/2] Substitute ${{package.srcdir}} during build Signed-off-by: dann frazier --- pkg/config/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index 643e83b53..358f92536 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -972,6 +972,7 @@ func buildConfigMap(cfg *Configuration) map[string]string { SubstitutionPackageDescription: cfg.Package.Description, SubstitutionPackageEpoch: strconv.FormatUint(cfg.Package.Epoch, 10), SubstitutionPackageFullVersion: fmt.Sprintf("%s-r%d", cfg.Package.Version, cfg.Package.Epoch), + SubstitutionPackageSrcdir: container.DefaultWorkspaceDir, } for k, v := range cfg.Vars {