Handle case when no packages are installed in the system, and add test for it

This commit is contained in:
Ettore Di Giacinto
2019-06-04 22:05:52 +02:00
parent 39a3e433a7
commit 2b095601eb
2 changed files with 25 additions and 0 deletions

View File

@@ -82,6 +82,10 @@ func (s *Solver) BuildFormula() (bf.Formula, error) {
return nil, err
}
W := bf.Var(encodedW)
if len(s.Installed) == 0 {
formulas = append(formulas, bf.And(bf.True, W))
continue
}
for _, installed := range s.Installed {
encodedI, err := installed.IsFlagged(true).Encode()
if err != nil {