Add IsSelector() to Package

It indicates if the package is a selector, by checking if versions
contains constraints signs (<>=)
This commit is contained in:
Ettore Di Giacinto
2019-12-17 18:00:27 +01:00
committed by Ettore Di Giacinto
parent 38cef9444c
commit 0627b03121

View File

@@ -21,6 +21,7 @@ import (
"fmt"
"path/filepath"
"sort"
"strings"
// . "github.com/mudler/luet/pkg/logger"
@@ -77,6 +78,8 @@ type Package interface {
SetLicense(string)
GetLicense() string
IsSelector() bool
}
type Tree interface {
@@ -179,6 +182,10 @@ func (p *DefaultPackage) SetPath(s string) {
p.Path = s
}
func (p *DefaultPackage) IsSelector() bool {
return strings.ContainsAny(p.GetVersion(), "<>=")
}
// AddUse adds a use to a package
func (p *DefaultPackage) AddUse(use string) {
for _, v := range p.UseFlags {