From c7b79bf630a75927b9ceffd6d71b521cb3e30c0d Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 8 Apr 2021 15:22:00 +0200 Subject: [PATCH] Compiler recipe now saves the entire tree --- pkg/tree/compiler_recipe.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/tree/compiler_recipe.go b/pkg/tree/compiler_recipe.go index a7f57147..c9e4bd86 100644 --- a/pkg/tree/compiler_recipe.go +++ b/pkg/tree/compiler_recipe.go @@ -57,6 +57,17 @@ type CompilerRecipe struct { Recipe } +// CompilerRecipes copies tree 1:1 as they contain the specs +// and the build context required for reproducible builds +func (r *CompilerRecipe) Save(path string) error { + for _, p := range r.SourcePath { + if err := helpers.CopyDir(p, filepath.Join(path, filepath.Base(p))); err != nil { + return errors.Wrap(err, "while copying source tree") + } + } + return nil +} + func (r *CompilerRecipe) Load(path string) error { r.SourcePath = append(r.SourcePath, path)