Clean build dirs for each package after build

This commit is contained in:
Ettore Di Giacinto 2019-11-17 13:27:32 +01:00
parent dea8ea7f9a
commit d0b128000d
No known key found for this signature in database
GPG Key ID: 1ADA699B145A2D1C

View File

@ -160,10 +160,18 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
// and we build all the images first.
keepImg := true
keepPackageImg := true
buildDir := p.Rel("build")
err := os.MkdirAll(p.Rel("build"), os.ModePerm)
if err != nil {
return nil, errors.Wrap(err, "Error met while creating tempdir for building")
}
buildDir, err := ioutil.TempDir(p.Rel("build"), "pack")
if err != nil {
return nil, errors.Wrap(err, "Error met while creating tempdir for building")
}
defer os.RemoveAll(buildDir) // clean up
// First we copy the source definitions into the output - we create a copy which the builds will need (we need to cache this phase somehow)
err := helpers.CopyDir(p.GetPackage().GetPath(), buildDir)
err = helpers.CopyDir(p.GetPackage().GetPath(), buildDir)
if err != nil {
return nil, errors.Wrap(err, "Could not copy package sources")