proper handling of "orphan" packages

This prevents the `[WARNING] External solver failed with inconsistent return value.` when
a package which last-version is installed and no longer available needs to be downgraded.
This may happen when you `opam repo remove` a development repo, typically.

Note that with this patch, the warning is avoided but the current solvers _can't_ optimize
the "distance" of the downgrade, so instead of getting the last-available version you will
get an arbitrary one.

In is current stage this patch is more of a basis for reflexion.