APT

apt:main

Last commit made on 2024-05-16
Get this branch:
git clone -b main https://git.launchpad.net/apt

Branch merges

Branch information

Name:
main
Repository:
lp:apt

Recent commits

3347b7a... by David Kalnischkies

Deal better with spurious spaces in arch restrictions

Another instance of our parser written for sane clean input, but
nowadays used also for user-provided input which can contain very many
strange formatting and especially white spaces all over the place.

Closes: #1071219

f404c8e... by David Kalnischkies

Do not save new if we have already installed providers

Companion of the previous commit that uses the same reasoning, but from
the other side of the logic (as we start from reverse deps here) so that
we are dropping the useless NEW from the solution.

Ideally this code would not live in -private, but in -pkg, but there is
not really a pre-existent good central place for this currently as a
sort-of fixup for our default resolver given this is the result of
resolver decision to not do something which had ripple effects that
aren't reverted along with it.

It is a bit unlikely that this is fixing all instances that this bug
has given we have dealt with a few instances of it already as they are
relatively obscure situations to clean up after and the cost of being
wrong (= autoremover generating breaks) is much higher than being
correct (= no pointless install – that is likely installed later anyhow
after the temporary automatic hold is lifted). And by virtue of being
the result of mostly temporary situations its also unlikely to be
debugable in hindsight months later; so if there is another situation,
its better to deal with it in a new bugreport.

Closes: #839546

b1c3039... by David Kalnischkies

Do not mark new if we have already installed providers

The test is actually documenting another bug hidden a bit by this one as
we do not need to install a NEW package in this situation as the upgrade
needing it was kept back, but it was protected from considering it to
be autoremoveable as all providers tend to be considered protected, but
by limiting us to installed providers if we have some we can drag those
new packages out of hiding.

Now, we "just" have to get right of the NEW package in a next step.

15f7214... by David Kalnischkies

Fix accidental silencing of output differences in tests

Removing every line with at least three characters at the end makes
comparisons for output differences rather easy to pass. The intend
was to match for '\.\.\.' but given we have to adapt the strings to
include autoremove remarks we can also include the string that appeared
now that state information is provided (in the form of autobits).

Regession-Of: 734eb9ac3f65e38ac3ba7f2d50ea206743a6f611

17ea3fc... by Julian Andres Klode

Release 2.9.3

422fb4f... by Julian Andres Klode

Merge branch 'solver3' into 'main'

Initial implementation of the 3.0 solver

See merge request apt-team/apt!347

d2323b1... by Julian Andres Klode

EDSP: Add "solver3" alias for apt-internal-solver

This invokes the 3.0 solver. It has a nicer name for
a binary, matching the communicated codename.

6f504c0... by Julian Andres Klode

test-allow-scores-for-all-dependency-types: Adjust for solver3

It relies on removing packages, so we must allow it to. To see
if it does the right thing, mark all packages automatically
installed.

734eb9a... by Julian Andres Klode

test: Ignore progress output in comparing output..

89dcc34... by Julian Andres Klode

Initial implementation of the 3.0 solver

This is a simple backtracking brute-force solver with heurisitcs,
this initial version has the following known gaps:

- Errors are not kept from branches, the error reporting after
  backtracking isn't particularly useful.
- We cannot show automatically removed packages
- We cannot replace packages with others
- We do not have conflict-driven clause learning yet

Untested:

- Multi-arch

This solver is fundamentally different in key aspects:

- It solves smaller dependency groups before larger ones, leading
  us to avoid installing A in A|B if B is installed more often and
  more consistently.

- It only keeps the automatic packages reachable via the strongest
  path. Currently it only implements autoremoval, but not display
  of autoremoval as we simply enqueue all automatically installed
  packages at the end when not doing automatic removal.

  This will need some translation where we Solve() first, and then
  Solve() again with the automatically installed packages added such
  that we can mark them as Garbage for display purposes.

- It does not remove manually installed packages.

Hook the solver in via the EDSP framework, this allows us to achieve
easy initial integration without lots of issues.

A lot of this work was planned and executed in my free time and then
some leaked into work time I suppose.

Implementation notes:

- Restore the full backlog of items

  The annoying thing is that we record only when an item was enqueued
  and not the level at which it was installed, so when going back a
  decision level we might have to reinstall packages that were queued
  at an earlier decision level because they were only installed at a
  later decision level.

- When picking one version, reject the others

- Propagate conflicts up to reverse dependencies

  This will recursively mark every reverse dependency that can
  no longer be satisfied as MUSTNOT.

  Also make sure to recursively call Reject(Ver) from Reject(Pkg)
  to make sure we trigger the Rejections there.

  This means we now end up having Recursion in the algorithm. An
  alternative approach would be to push *reject* items to the heap
  and then do them, but this is not entirely straight forward and
  it may simply not be necessary.

- Sort upgrades before other optional installs containing subsets

  If I want to upgrade a package A, I schedule A3|A2|A1; if another
  thing depends specifically on A1; we'd not be installed. Hence we
  need to sort upgrades first.

  This only is needed for optional packages; manual packages will
  figure this out naturally.

- Rescoring is lazily implemented. Instead of calling make_heap()
  after rescoring items, we just mark the items as dirty and reinsert
  them. We also only rescore from the main solve loop, Reject() marks
  the heap as needing a rescore due to a Conflict (as some versions will
  no longer be installable), and RescoreWorkIfNeeded() then will do the
  rescoring.

- Recursive unit propagation: Install() and Reject() recursively call
  each other to promote decisions across single-version dependencies
  (or across not-anymore satisfiable reverse-depends).

- Make Reason constructors explicit, this enhances readability

  This makes calls like the one in here be

    Reject(object, Reason(otherObject))

  Ensuring that it's clear that the 2nd argument is a reason at the
  caller side.

- Split Decision into Decision and Hint vs. first draft

  When branching/deciding, we do not want to override SHOULD and MAY.
  We do not actually use them yet, and we do actually clean them when
  backtracking, but let's at least keep the data structure correct.

  Convert the enum to a 16-bit integer so we can still fit in the same
  space as before.