From e1f332324f81b589561a9d9bce8a55d4895f26ec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 2 Sep 2022 11:07:58 +0200 Subject: 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. --- test/integration/test-multiarch-allowed | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/integration/test-multiarch-allowed') diff --git a/test/integration/test-multiarch-allowed b/test/integration/test-multiarch-allowed index db7f37169..fc63d0e33 100755 --- a/test/integration/test-multiarch-allowed +++ b/test/integration/test-multiarch-allowed @@ -62,11 +62,17 @@ Inst foo:i386 (1 unstable [i386]) Inst needsfoo:i386 (1 unstable [i386]) Conf foo:i386 (1 unstable [i386]) Conf needsfoo:i386 (1 unstable [i386])' aptget install needsfoo:i386 -s +# FIXME: same problem, but two different unmet dependency messages depending on install order testfailureequal "$BADPREFIX The following packages have unmet dependencies: - needsfoo:i386 : Depends: foo:i386 but it is not installable + foo : Conflicts: foo:i386 but 1 is to be installed + foo:i386 : Conflicts: foo but 1 is to be installed E: Unable to correct problems, you have held broken packages." aptget install needsfoo:i386 foo:amd64 -s testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needsfoo:i386 : Depends: foo:i386 but it is not installable +E: Unable to correct problems, you have held broken packages." aptget install foo:amd64 needsfoo:i386 -s +testfailureequal "$BADPREFIX The following packages have unmet dependencies: foo : Conflicts: foo:i386 but 1 is to be installed foo:i386 : Conflicts: foo but 1 is to be installed -- cgit v1.2.3-70-g09d2