diff --git a/pkg/config/config.go b/pkg/config/config.go index f4263fca..5e26d9db 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -71,6 +71,15 @@ type LuetSolverOptions struct { Implementation solver.SolverType `mapstructure:"implementation"` } +func (opts LuetSolverOptions) ResolverIsSet() bool { + switch opts.Type { + case solver.QLearningResolverType: + return true + default: + return false + } +} + func (opts LuetSolverOptions) Resolver() solver.PackageResolver { switch opts.Type { case solver.QLearningResolverType: diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index c76d158a..ac03d8fa 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -288,16 +288,18 @@ func (l *LuetInstaller) Install(cp pkg.Packages, s *System) error { Info("No packages to install") return nil } - - for _, p := range cp { - found := false - for _, m := range match { - if m.Package.GetName() == p.GetName() { - found = true + // Resolvers might decide to remove some packages from being installed + if !l.Options.SolverOptions.ResolverIsSet() { + for _, p := range cp { + found := false + for _, m := range match { + if m.Package.GetName() == p.GetName() { + found = true + } + } + if !found { + return fmt.Errorf("Package '%s' not found", p.HumanReadableString()) } - } - if !found { - return fmt.Errorf("Package '%s' not found", p.HumanReadableString()) } }