Make sure we do compute the best fit

While install calls upgrade which in turns calls a relaxed install on
its results, this doesn't make sure that the new results are at the best
available version. We do iterate here over the results to compute the
best set.

It also expands computeUpgrade with the possibility to selectively
choose which packages to upgrade and which not.
This commit is contained in:
Ettore Di Giacinto
2021-10-10 19:04:55 +02:00
parent 780b7aa610
commit 6ba028f0ea
3 changed files with 188 additions and 138 deletions

View File

@@ -146,6 +146,17 @@ func (assertions PackagesAssertions) Search(f string) *PackageAssert {
return nil
}
func (assertions PackagesAssertions) ToDB() pkg.PackageDatabase {
db := pkg.NewInMemoryDatabase(false)
for _, a := range assertions {
if a.Value {
db.CreatePackage(a.Package)
}
}
return db
}
func (assertions PackagesAssertions) Order(definitiondb pkg.PackageDatabase, fingerprint string) (PackagesAssertions, error) {
orderedAssertions := PackagesAssertions{}