From 679b6a8e93bdcec9cdf3ea00fb461043083a632b Mon Sep 17 00:00:00 2001 From: Michal Gorecki Date: Fri, 12 Jan 2024 13:50:49 +0100 Subject: [PATCH] newt: Add possibility to mark package as experimental This adds possibility to mark package as experimental by adding "pkg.experimental: 1" line in the pkg.yml file. --- newt/builder/targetbuild.go | 6 +++++- newt/resolve/resolve.go | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/newt/builder/targetbuild.go b/newt/builder/targetbuild.go index 675d4e017..c7efc03aa 100644 --- a/newt/builder/targetbuild.go +++ b/newt/builder/targetbuild.go @@ -284,7 +284,11 @@ func (t *TargetBuilder) validateAndWriteCfg() error { log.Warn(line) } - for _, line := range t.res.ExperimentalWarning() { + for _, line := range t.res.CfgExperimentalWarning() { + log.Warn(line) + } + + for _, line := range t.res.PkgExperimentalWarning() { log.Warn(line) } diff --git a/newt/resolve/resolve.go b/newt/resolve/resolve.go index c04d33364..ef883de52 100644 --- a/newt/resolve/resolve.go +++ b/newt/resolve/resolve.go @@ -1358,10 +1358,27 @@ func (res *Resolution) DeprecatedWarning() []string { return res.Cfg.DeprecatedWarning() } -func (res *Resolution) ExperimentalWarning() []string { +func (res *Resolution) CfgExperimentalWarning() []string { return res.Cfg.ExperimentalWarning() } +func (res *Resolution) PkgExperimentalWarning() []string { + lines := []string{} + + for pkg := range res.LpkgRpkgMap { + experimental, err := pkg.PkgY.GetValBool("pkg.experimental", nil) + if err != nil { + log.Errorf("Internal error; Could not read package %s yml file", pkg.Name()) + } + if experimental { + lines = append(lines, + fmt.Sprintf("Use of experimental package %s", pkg.Name())) + } + } + + return lines +} + func LogTransientWarning(lpkg *pkg.LocalPackage) { if lpkg.Type() == pkg.PACKAGE_TYPE_TRANSIENT { log.Warnf("Transient package %s used, update configuration "+