Skip to content

Commit

Permalink
newt: Add possibility to mark package as experimental
Browse files Browse the repository at this point in the history
This adds possibility to mark package as experimental
by adding "pkg.experimental: 1" line in the pkg.yml file.
  • Loading branch information
m-gorecki authored and sjanc committed Mar 4, 2024
1 parent ba89f15 commit 679b6a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion newt/builder/targetbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
19 changes: 18 additions & 1 deletion newt/resolve/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 "+
Expand Down

0 comments on commit 679b6a8

Please sign in to comment.