1841 Commits

Author SHA1 Message Date
Julian Andres Klode f8497bb5e4 Merge branch 'pu/phased-updates-fixes-2022-09-23' into 'main'
phased update improvements

See merge request apt-team/apt!262
2022-09-28 15:13:12 +00:00
Julian Andres Klode 5f5a8deedf full-upgrade: Mark phased upgrades for keep before anything else
By marking them at the end, we might make other decisions that
depend on the new phased updates, confusing the solver. Run the
marking at the start too.

The EDSP test file from Jeremy was modified to include Machine-ID
and Phased-Update-Percentage fields and then filtered to mostly
exclude packages irrelevant to the test case by running

    grep-dctrl   \( -FRequest "EDSP 0.5" -o -FInstalled yes \
                    -oFPhased-Update-Percentage 10  \)  \
                -a --not -FArchitecture i386

LP: #1990586
2022-09-28 16:32:44 +02:00
Julian Andres Klode f93a5aa2da Check state of dependency, not dependee in dependency keep back
When iterating over I's dependencies (which are called Pkg), we
accidentally checked if I was Protected() instead of Pkg when deciding
whether Pkg can be kept back.

LP: #1990684
2022-09-28 16:32:44 +02:00
Julian Andres Klode 8d35404027 Merge branch 'fix/install-pkg-order' into 'main'
Respect users pkg order on `apt install` for resolving

See merge request apt-team/apt!256
2022-09-21 10:48:54 +00:00
Khem Raj 81a5256298 interactive-helper: Undefine _FORTIFY_SOURCE
This ensures that it compiles when clang compiler is passing
-DFORTIFY_SOURCES=2

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-09-16 20:07:40 -07:00
David Kalnischkies e1f332324f Respect users pkg order on apt install for resolving
The command line is evaluated in two steps: First all packages given
are marked for install and as a second step the resolver is started on
all of them in turn to get their dependencies installed.

This is done so a user can provide a non-default choice on the command
line and have it respected regardless of where on the command line it
appears.

On the other hand, the order in which dependencies are resolved can
matter, so instead of using a "random" order, we now do this in the
order given on the command line, so if you e.g. have a meta package
pulling in non-default choices and mention it first the choices are
respected predictably instead of depending on first appearance of the
package name while creating the binary cache.

I might have "broken" this more than a decade ago while introducing the
reworked command line parsing for Multi-Arch, which also brought in the
split into the two steps mentioned above which was the far more
impactful 'respect user choice' change. This one should hardly matter in
practice, but as the tests show, order can have surprising side effects.
2022-09-02 23:37:58 +02:00
Julian Andres Klode 518746f7e0 Add flag to disable upgrade by source and test case 2022-07-24 15:44:13 +02:00
Julian Andres Klode 119a8d0ed1 Upgrade all binaries in a source package
Schedule all other binaries in the source package for upgrade if
the candidate version belongs to the same source version as the
package we are upgrading.

This will significantly reduce the risk of partial upgrades and
should make life a lot easier.
2022-07-24 15:27:18 +02:00
Julian Andres Klode 07fe16bcc6 Add test cases 2022-07-11 18:06:59 +02:00
Julian Andres Klode e077370ffc Mark broken reverse depends for upgrade
Currently the solver handles cases where a Breaks b (<< 1) and
if we install that a, upgrades b. However, where b Depends a (= 1),
b was removed again.

This addresses the problem by iterating over installed reverse
dependencies of upgrades and upgrading them so that both cases
work roughly similarly.

LP: #1974196
2022-07-11 16:37:33 +02:00
Julian Andres Klode 8416bcb58c test-phased-updates-upgrade: Tests with arguments
Pass some package names to upgrade to see that that works

Gbp-Dch: ignore
2022-06-30 13:21:19 +02:00
Julian Andres Klode 20739359fa policy: Do not override negative pins with 1 due to phasing
If a package is already pinned to a negative value, we should not
override this with a positive 1. This causes packages to be installable
that were pinned to -1, which is not intended.

For this, implement phasing as a ceiling of 1 for the pin instead
of a fixed 1 value. An alternative would have been to fix it to
NEVER_PIN, but that would mean entirely NEW packages would not be
installable while phasing which is not the intention either.

LP: #1978125
2022-06-28 14:54:42 +02:00
Julian Andres Klode db131677be (Temporarily) Rewrite phased updates using a keep-back approach
This is a lot closer to the original implementation in update-manager,
but still has a couple of differences that might cause bugs:

- When checking whether a version is a security update, we only
  check versions in between and not any later version. This happens
  mostly because we do not know the suite, so we just check if there
  is any version between the installed version and our target that
  is a security update

- We only keep already installed packages, as we run before the
  resolver. update-manager first runs the resolver, and then marks
  for keep all packages that were upgraded or newly installed that
  are phasing (afaict).

This approach has a significant caveat that if you have version 1
installed from a release pocket, version 2 is in security, and version
3 is phasing in updates, that it installs version 3 rather than 2
from security as the policy based implementation does.

It also means that apt install does not respect phasing and would
always install version 3 in such a scenario.

LP: #1979244
2022-06-28 14:25:18 +02:00
David Kalnischkies 320245536a Include our config.h in all C++ files to avoid ODR violations
Some of our headers use APT_COMPILING_APT trickery to avoid exposing too
broadly details we don't want external clients to know and make use of.
The flip-side is that this can lead to different compilation units
seeing different definitions if they aren't all using the same config.
2022-05-07 10:45:44 +02:00
David Kalnischkies e5aa5c04ec Ignore stty failures in testcases
We use 'stty sane' to combat against stepped output and co caused by
(especially) failed tests, but it does so many things that it
occasionally fails to reset some bits in the parallel interaction we
have with it which fails the tests without a real problem in apt…

Ideally we would be better at stitching the output together, but for the
time being lets ignore these failures instead to stabilize the tests.
2022-05-07 10:45:44 +02:00
David Kalnischkies 8d8b45a96c Link interactive helpers against system libapt for autopkgtest
Building the library just so we can build the helpers against it is not
only wasteful but as we are supposed to test the system we can use that
as an additional simple smoke test before the real testing starts.
2022-05-07 10:45:44 +02:00
Julian Andres Klode 97f16727b5 Merge branch 'fix/tagfilekeys' into 'main'
Consistently dealing with fields via pkgTagSection::Key

See merge request apt-team/apt!233
2022-05-06 16:20:52 +00:00
Julian Andres Klode 824651ded0 Only protect two kernels, not last installed one
The kernel autoremoval algorithm was written to accomodate
for Ubuntu's boot partition sizing, which was written to
accomodate 3 kernels - 2 installed ones + a new one being
unpacked.

It seems that when the algorithm was designed, it was overlooked
that it actually kept 3 kernels.

LP: #1968154
2022-04-07 13:19:52 +02:00
David Kalnischkies 05fae6fae9 Parse Checksum fields via pkgTagSection::Key, too
We abstract hashes a fair bit to be able to add new ones eventually,
which lead us to building the field names on the fly. We can do better
through by keeping a central place for these names, too, which even
helps in reducing code as we don't need the MD5 → Files dance anymore.
2022-04-01 14:16:19 +02:00
David Kalnischkies 2005f1c263 Do not order long obsoleted fields anymore
The dependency relation fields old names were deprecated in 1995
as the new ones were introduced. That seems barely long enough now
as a transition period.
2022-04-01 14:16:19 +02:00
David Kalnischkies 7b8da771e2 Drop support for long obsoleted Suggests alias: Optional
dpkg-dev stopped recognizing it in 2007 (1.14.7) while building packages.
The rename itself happened in 1995 (0.93.72).
2022-04-01 14:16:15 +02:00
David Kalnischkies f6438ea9e7 Document tagfile-keys.h as internal to apt
The previous regime of the file was to sort it on insert, but that
changes the values in the generated enum, which is fine as long as we
only use it in libapt itself, but breaks on other users.

The header was always intended to be private to apt itself, so we just
document this here now and lay the ground work to have the file in the
future only appended to, so that it remains sufficiently ABI stable that
we can use it outside the library in our apt tools.

We also remove some fields apt is unlikely to need or only uses in
certain cases outside of any (speed) critical path to have enough room
to add more fields soon as currently we are limited to 128 fields max
and it would be sad if we use up that allowance entirely already.
2022-04-01 14:15:26 +02:00
David Kalnischkies f0227a5d4c Use extra-environment to point to dpkg/dak sources
The hack is 7 years by now, so in an attempt to make that slightly
cleaner lets move this to proper variables that can be assigned via
an extra-environment file sources by the framework rather than relying
on my user name and locate in public.

Gbp-Dch: Ignore
2022-04-01 12:11:14 +02:00
David Kalnischkies 7e339dce78 Do not unique the field names in test to catch duplicates
It happens to the best, so it might happen for us, too, one day.
Better to catch it directly instead.

Gbp-Dch: Ignore
2022-04-01 12:11:14 +02:00
David Kalnischkies 4dd5e241af Fix build failure with gcc-12 due to missing include
apt/test/interactive-helper/aptwebserver.cc: In function ‘std::string HTMLEncode(std::string)’:
error: variable ‘constexpr const std::array<std::array<const char*, 2>, 6> htmlencode’ has initializer but incomplete type

Reported-By: Helmut Grohne on IRC
2022-03-21 02:57:24 +01:00