diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2025-03-09 13:55:23 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2025-03-09 13:55:23 +0100 |
| commit | 6c112f9860c1730237029f4e23d40bf658d73704 (patch) | |
| tree | 8f5f98fbe27ac7060b38e545eb43317215f1ae89 | |
| parent | 935a9ab334e55a29363f45e7de6338c47337e806 (diff) | |
Print --solver 3.0 explanation if both internal and it failed
This can provide useful additional context.
To avoid updating the whole test suite for it, introduce a new
option `quiet::NoSolver3Explanation` and set it by default. All
the other tests that assert output will already have matching
tests for --solver 3.0 with the correct messages asserted, it
makes no sense to duplicate them.
| -rw-r--r-- | apt-private/private-install.cc | 3 | ||||
| -rw-r--r-- | doc/examples/configure-index | 1 | ||||
| -rw-r--r-- | test/integration/framework | 2 | ||||
| -rwxr-xr-x | test/integration/test-solver3-evaluation | 21 |
4 files changed, 26 insertions, 1 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index cb9f93e9e..29e23a57e 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1024,6 +1024,9 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg transaction.temporaryRollback(); // Rollback to before internal solver made changes so we can dump the OG request WriteApportReport(Cache, error, errors, UpgradeMode, distUpgradeMode); } + + if (not res && not errors.empty() && not _config->FindB("quiet::NoSolver3Explanation", false)) + _error->Error("The following information from --solver 3.0 may provide additional context:\n%s", APT::String::Join(errors, "\n").c_str()); } // If the 3.0 solver could not recover either, abort. _error->MergeWithStack(); diff --git a/doc/examples/configure-index b/doc/examples/configure-index index d6d76930c..c36f922b6 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -33,6 +33,7 @@ quiet "<INT>" { NoUpdate "<BOOL>"; // never update progress information - included in -q=1 NoProgress "<BOOL>"; // disables the 0% → 100% progress on cache generation and stuff NoStatistic "<BOOL>"; // no "42 kB downloaded" stats in update + NoSolver3Explanation "<BOOL>"; // do not print solver3 explanations when used with internal solver ReleaseInfoChange "<BOOL>" // don't even print the notices if the info change is allowed { Origin "<BOOL>"; diff --git a/test/integration/framework b/test/integration/framework index d2570b6b2..3f0290569 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -589,6 +589,8 @@ EOF echo 'DPkg::Path "";' >> aptconfig.conf echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf + echo 'quiet::NoSolver3Explanation "true";' > rootdir/etc/apt/apt.conf.d/disable-solver3-context + # most tests just need one signed Release file, not both export APT_DONT_SIGN='Release.gpg' diff --git a/test/integration/test-solver3-evaluation b/test/integration/test-solver3-evaluation index d3521e9c6..af12698b5 100755 --- a/test/integration/test-solver3-evaluation +++ b/test/integration/test-solver3-evaluation @@ -16,6 +16,7 @@ insertpackage 'unstable' 'c' 'all' '3' setupaptarchive +rm rootdir/etc/apt/apt.conf.d/disable-solver3-context mkdir rootdir/var/log/apt testsuccess aptget install y x --solver internal -s -o Dir::Apport=var/crash @@ -217,4 +218,22 @@ APT-Pin: 100 APT-Candidate: yes " cat rootdir/var/log/apt/edsp.log - +testfailureequal "Reading package lists... +Building dependency tree... +Package 'c' is not installed, so not removed +Solving dependencies... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + a : Depends: c but it is not going to be installed +E: Unable to correct problems, you have held broken packages. +E: The following information from --solver 3.0 may provide additional context: + Unable to satisfy dependencies. Reached two conflicting decisions: + 1. a:amd64=3 is selected for install + 2. a:amd64 Depends c + but none of the choices are installable: + - c:amd64 is not selected for install" apt install -s a c- --solver internal |
