mirror of
https://github.com/mudler/luet.git
synced 2025-09-15 23:00:04 +00:00
Review version comparision logic
This commit is contained in:
committed by
Ettore Di Giacinto
parent
bbeb800611
commit
91d05b071d
@@ -83,6 +83,8 @@ type Package interface {
|
||||
GetLicense() string
|
||||
|
||||
IsSelector() bool
|
||||
VersionMatchSelector(string) (bool, error)
|
||||
SelectorMatchVersion(string) (bool, error)
|
||||
}
|
||||
|
||||
type Tree interface {
|
||||
@@ -322,15 +324,11 @@ func (p *DefaultPackage) Expand(definitiondb PackageDatabase) ([]Package, error)
|
||||
return nil, err
|
||||
}
|
||||
for _, w := range all {
|
||||
v, err := version.NewVersion(w.GetVersion())
|
||||
match, err := p.SelectorMatchVersion(w.GetVersion())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
constraints, err := version.NewConstraint(p.GetVersion())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if constraints.Check(v) {
|
||||
if match {
|
||||
versionsInWorld = append(versionsInWorld, w)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user