28 Commits

Author SHA1 Message Date
Niels Thykier
c4931fb1b2
solver: Move a common variable out of an if
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:38 +00:00
Niels Thykier
1e46965924
inst/builder.py: Split function in three to reduce indentation levels
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:37 +00:00
Niels Thykier
dd5211d55a
inst-tester: Add missing element to a set
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:36 +00:00
Niels Thykier
55dd190fa6
inst-tester: Make "check" a list
Should be slightly cheaper (O(1)) than using a set.

Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:35 +00:00
Niels Thykier
cd1f384012
inst-tester: Remove obsolete "safe-set" optimization
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:34 +00:00
Niels Thykier
95b945d2b3
inst-tester: Remove obsolete optimization
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-09-30 12:19:34 +00:00
Paul Gevers
713b98ad6b
inst_tester: add is_pkg_in_testing 2018-09-05 21:27:41 +02:00
Niels Thykier
b6888c2716 test-builder: Avoid allocating empty throw-away lists on empty relations
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 14:38:36 +00:00
Niels Thykier
373f7f51f3 inst-builder: Avoid some hash-look ups by doing them early
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 14:02:29 +00:00
Niels Thykier
35add7cb26 Move loop-invariant out of loop
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 13:50:22 +00:00
Niels Thykier
02001d4d4f inst-builder: Loop over values instead of keys + hash-lookup
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 13:18:43 +00:00
Niels Thykier
0446ead9e8 inst-builder: Replace RelationBuilder with a set_relations method
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 13:06:48 +00:00
Niels Thykier
ab6b2ef953 inst-builder: Refactor to bulk adding dependency clauses
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 12:47:11 +00:00
Niels Thykier
bc1d3afa38 inst-builder: Make add_breaks a bulk call
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 12:33:09 +00:00
Niels Thykier
6f97e36477 inst-builder: Split relation loop and optimize conflicts
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 12:25:20 +00:00
Niels Thykier
6a3d100b92 Fix error format string error in AssertionError
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 12:23:35 +00:00
Niels Thykier
fc834624fc Avoid some unnecessary hash look ups
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-08-12 08:37:07 +00:00
Niels Thykier
64d2bc4203 builder.py: Make the code suite agnostic
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-07-29 09:23:12 +00:00
Niels Thykier
41978869ce Migrate solver's ad-hoc debug logging
Signed-off-by: Niels Thykier <niels@thykier.net>
2018-03-31 07:04:35 +00:00
Niels Thykier
69473eefca solver: Extract compute_scc into a function
Signed-off-by: Niels Thykier <niels@thykier.net>
2017-07-29 07:54:48 +00:00
Niels Thykier
bd375fdd85 solver: Make _compute_scc iterative
Rewrite _compute_scc to be iterative to avoid call recursion limit for
graphs with long dependency chains.

Signed-off-by: Niels Thykier <niels@thykier.net>
2017-07-29 07:40:15 +00:00
Niels Thykier
64653087d0 solver: Fix bug where some items were not emitted
Sometimes the solver would correctly compute which items are grouped
together, but then fail to emit some groups.  This is trivially
fixable by forcing an update of "before" + "after" relations.
Admittedly, this looks unnecessary, so it may just be hiding the bug.

Nonetheless, the change makes the new test_solver_simple_scc test
produce the expected result.

Signed-off-by: Niels Thykier <niels@thykier.net>
2017-07-28 21:36:01 +00:00
Niels Thykier
42be17ad26 inst-tester: Correctly handle unresolved essential choices
Britney has a special case for essential packages to ensure that any
package that with essential packages are not installable.  This check
did not account for a case, where a package is not co-installable with
two or more pseudo-essential package part of the same OR dependency.
A contrived example based on real world data:

  Package: foo
  # Conflict with all providers of "awk"
  Conflicts: mawk | gawk | original-awk

This alone is actually not sufficient to trigger the bug, as
_get_min_pseudo_ess_set is in theory some times smart enough to pick
an "obvious" solution between the pseudo-essential option.
  When it does, one of the above ends up in the (de-facto) essential set
and then the installability tester correctly rejects "foo".

Though, even with the fix above, the handling for this is probably not
correct if the essential set is not (fully co-)installable.  However,
that basically only happens if we are bootstrapping an architecture
(or testing is royally broken, in which case this is the least of our
worries).

Signed-off-by: Niels Thykier <niels@thykier.net>
2017-02-11 11:08:52 +00:00
Niels Thykier
0cc7f7a8d2 Move build_installability_tester to builder.py
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-22 21:03:40 +00:00
Niels Thykier
a14ced6403 Drop now unused "from __future__" imports
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-22 20:21:06 +00:00
Niels Thykier
a768432eb2 solver.py: Add missing "no cover" pragma
Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-22 20:21:06 +00:00
Niels Thykier
20c2b87833 Sprinkle some "no cover" pragmas over the code base
Add some "no cover" to some unrecoverable exceptions
(e.g. misconfiguration) or base-class methods that are not intended to
be invoked.

Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-13 11:39:46 +00:00
Niels Thykier
9bc94db01c Refactor all modules into a britney2 subdir
That way they are all contained.

Signed-off-by: Niels Thykier <niels@thykier.net>
2016-11-13 08:02:00 +00:00