Disable like distros if LURE_DISTRO is set

This commit is contained in:
Elara 2022-10-01 20:56:08 -07:00
parent 74adb915fc
commit a02a009b63
1 changed files with 8 additions and 0 deletions

View File

@ -107,8 +107,10 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
return nil, nil, err
}
var distroChanged bool
if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
info.ID = distID
distroChanged = true
}
fl, err := os.Open(script)
@ -140,6 +142,12 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
dec := decoder.New(info, runner)
// If distro was changed, the list of like distros
// no longer applies, so disable its use
if distroChanged {
dec.LikeDistros = false
}
var vars BuildVars
err = dec.DecodeVars(&vars)
if err != nil {