Package.all_dependencies(): add optional header_name argument

preparation for replacing depends_with_alts() with all_dependencies()

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
replace depends_with_alts() with all_dependencies()

only the names of the dependencies are needed,
not the complete parsed entries

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
remove redundant variable prefer_alt_idx

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
do not care about old versions of untestable packages

If an old log is in untestable/ (usually because of some dependency
issue) do not let this block testing of a newer package version.
The new package may fix the issue. Just test the new package like if
it were in any other state. Do not wait for reschedule_untestable.

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
drop LogDB.any_log_exists()

unused and rather I/O intensive method

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
prepare simplification of package and dependency states

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
propagate dep.-does-not-exist -> dep.-cannot-be-tested

dependency-does-not-exist should only contain direct errors, i.e.
dependencies on does-not-exist packages, not indirect ones
dependency-cannot-be-tested is an indirect error state that may have
different causes and needs to be fixed in a different package

Signed-off-by: Andreas Beckmann <debian@abeckmann.de>
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>
factor out the list of 'good' states

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>