remove no-dependency-from-alternatives-exists state

replace 'no-dependency-from-alternatives-exists' with
'dependency-does-not-exist', no need to distinguish them
inheriting failures will be 'dependency-cannot-be-tested'

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
remove 'unknown-preferred-alternative' state

Remove 'unknown-preferred-alternative' state as it interferes with
circular dependencies involving alternatives and virtual packages.
Setting 'unknown-preferred-alternative' usually happened on the
full circle and skipped the special handling of known circular
depends, so the package never got a change to be tested.
Now these packages will be just tracked as 'unknown'.

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
always update preferred alternative

Update the preferred alternative even if we only select a package
in "waiting-*"/"unknown" state.
That way the subsequent checks may work on better (non-failed)
alternatives and circular dependencies involving virtual depends
and alternative depends can be resolved.
Keeping the 'unknown' state asks for a later revisit after some
of the unknown alternative deps may have been resolved.

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
defer propagation of failures while resolving alternatives

do not inherit failures when resolving alternate dependencies,
this will be done later anyway

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
cleanup computation of waiting-to-be-tested state

do not abuse strings as booleans

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
drop circular-dependency state

we will compute and break the cycles ourselves so that we don't need to
maintain known_circular_depends manually any longer

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
fix waiting-to-be-tested for known circular deps

fix logic error (a package can have multiple deps that are circular deps,
in that case none of them may have failed or we can't test the package)
cleanup/simplify, don't abuse strings as booleans

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
cache package.dependencies()

do not recompute package.dependencies() for every loop

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
propagate error and waiting states separately

propagate waiting states after handling circular dependencies
as in some corner cases this could result in cycles waiting for itself

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
simplify deciding testability of circular deps

no need to handle dependencies in error state when checking
circular deps - already covered by error propagation

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
add get_dependency_cycle method

PackagesDB._get_dependency_cycle(self, package)
returns the dependency cycles(s) that contain the given package,
including the package, or [] if the package is not on a cycle

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
compute and automatically break dependency cycles

stop relying on known_circular_depends which require regular manual updates

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
remove known_circular_depends from piuparts.conf handling

since circular dependencies are computed automatically,
we no longer need to handle them in the config file

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>