Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

We may not want to raise NoPackageFound when trying to remove non-existing package #136

Open
cournape opened this issue Feb 19, 2016 · 6 comments

Comments

@cournape
Copy link
Contributor

@johntyree what do you think ?

@johntyree
Copy link
Contributor

Why wouldn't we?

@cournape
Copy link
Contributor Author

good question :) It is a bit difficult to handle the case of the user asking to remove something that is not installed. Actually, it is not right now, as we assume "name == provide", but that may not be trivial anymore later on.

So I think there should be a way in satsolver to easily notify the solver consumer that a package about to be removed cannot be found (different exception, maybe subclass ot NoPackageFound), or at least an API to check this case, so that we can give a meaningful error to the user.

@johntyree
Copy link
Contributor

The sat-solver is not who determines which package is which, though. That comes from the outside in the form of a bunch of repositories of PackageMetadata instances that are constructed by whoever knows what is available upstream, right?

@cournape
Copy link
Contributor Author

If you refer to providers, then the solver itself would not know, but the Pool would. So we could e.g. do something like:

for job in request.jobs:
  if job.kind == JobKind.remove:
    candidates = pool.what_provides(job.requirement)
    if len(candidates) == 0:
       # no candidate at all, likely a user error
    else:
      for candidate in candidates:
        if candidate in installed_repository:
          break
      else:
        # the package is available but is not installed

I think doing this check in solve kinda makes sense ?

@johntyree
Copy link
Contributor

How does the pool find out what provides what if it does not come from upstream?

@johntyree
Copy link
Contributor

We can have different errors for "non-existent package" vs "can't uninstall package that isn't installed," but in either case, this isn't really a solver issue, I would think. Upstream knows what's installed before it ever invokes the solver.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants