mirror of
https://github.com/mudler/luet.git
synced 2025-09-01 07:09:13 +00:00
Expand also when selecting candidates to install/uninstall
This commit is contained in:
@@ -114,12 +114,18 @@ func (s *Solver) BuildWorld(includeInstalled bool) (bf.Formula, error) {
|
||||
|
||||
func (s *Solver) getList(db pkg.PackageDatabase, lsp []pkg.Package) ([]pkg.Package, error) {
|
||||
var ls []pkg.Package
|
||||
w := db.World()
|
||||
|
||||
for _, pp := range lsp {
|
||||
cp, err := db.FindPackage(pp)
|
||||
if err != nil {
|
||||
cp = pp //Relax search, otherwise we cannot compute solutions for packages not in definitions
|
||||
|
||||
//return nil, errors.Wrap(err, "Package not found in db")
|
||||
packages, err := pp.Expand(&w)
|
||||
// Expand, and relax search - if not found pick the same one
|
||||
if err != nil || len(packages) == 0 {
|
||||
cp = pp
|
||||
} else {
|
||||
cp = pkg.Best(packages)
|
||||
}
|
||||
}
|
||||
ls = append(ls, cp)
|
||||
}
|
||||
@@ -193,7 +199,17 @@ func (s *Solver) Uninstall(c pkg.Package) ([]pkg.Package, error) {
|
||||
var res []pkg.Package
|
||||
candidate, err := s.InstalledDatabase.FindPackage(c)
|
||||
if err != nil {
|
||||
candidate = c //Relax search, otherwise we cannot compute solutions for packages not in definitions
|
||||
w := s.InstalledDatabase.World()
|
||||
|
||||
// return nil, errors.Wrap(err, "Couldn't find required package in db definition")
|
||||
packages, err := c.Expand(&w)
|
||||
// Info("Expanded", packages, err)
|
||||
if err != nil || len(packages) == 0 {
|
||||
candidate = c
|
||||
} else {
|
||||
candidate = pkg.Best(packages)
|
||||
}
|
||||
//Relax search, otherwise we cannot compute solutions for packages not in definitions
|
||||
// return nil, errors.Wrap(err, "Package not found between installed")
|
||||
}
|
||||
// Build a fake "Installed" - Candidate and its requires tree
|
||||
|
Reference in New Issue
Block a user