mirror of
https://github.com/mudler/luet.git
synced 2025-09-13 22:01:39 +00:00
Do not call solver multiple times, reuse same assertion
Introduce Cut(), it allows to filter in the assertion to achieve the same hashes
This commit is contained in:
@@ -144,6 +144,7 @@ func (assertions PackagesAssertions) Search(f string) *PackageAssert {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (assertions PackagesAssertions) Order(definitiondb pkg.PackageDatabase, fingerprint string) PackagesAssertions {
|
||||
|
||||
orderedAssertions := PackagesAssertions{}
|
||||
@@ -263,3 +264,18 @@ func (assertions PackagesAssertions) Drop(p pkg.Package) PackagesAssertions {
|
||||
}
|
||||
return ass
|
||||
}
|
||||
|
||||
// Cut returns an assertion list of installed (filter by Value) "cutted" until the package is found (included)
|
||||
func (assertions PackagesAssertions) Cut(p pkg.Package) PackagesAssertions {
|
||||
ass := PackagesAssertions{}
|
||||
|
||||
for _, a := range assertions {
|
||||
if a.Value {
|
||||
ass = append(ass, a)
|
||||
if a.Package.Matches(p) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return ass
|
||||
}
|
||||
|
Reference in New Issue
Block a user