summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* extracttar: Move large buffer to heap for valgrindJulian Andres Klode2024-10-221-5/+7
| | | | | | | valgrind has some trouble on ppc64el with the large buffer, and also on armhf where it seems to not understand the resulting stack clash protector, so let's move it to the heap using simple STL std::array in a std::unique_ptr.
* Merge branch 'pin-source-version' into 'main'Julian Andres Klode2024-08-223-2/+12
|\ | | | | | | | | Implement 'Pin: source-version <foo>' See merge request apt-team/apt!372
| * Implement 'Pin: source-version <foo>'Julian Andres Klode2024-08-223-2/+12
| | | | | | | | As wondered about by Paride some minutes ago.
* | Fix compilation error with clang/libc++ 18Chongyun Lee2024-08-151-2/+2
|/
* Merge branch 'main' into 'main'Julian Andres Klode2024-08-121-0/+2
|\ | | | | | | | | Do not return error if `Signed-By` value in source list is empty See merge request apt-team/apt!364
| * Do not return error if `Signed-By` value in source list is emptyAristo Chen2024-07-121-0/+2
| | | | | | | | Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
* | Fix obsoleted-by handling for experimentalJulian Andres Klode2024-08-122-13/+40
| | | | | | | | | | | | | | | | | | | | Basically this boils down to checking that the priority of the source candidate candidate is higher or equal than the priority of the package's candidate that is being under consideration. It stands to reason if we maybe we should actually calculate a source candidate version; this will look similar but may perhaps perform slightly different.
* | Merge branch 'deprecate-pubkey-algos' into 'main'Julian Andres Klode2024-07-304-1/+41
|\ \ | | | | | | | | | | | | Only revoke weak RSA keys now, add 'next' and 'future' levels See merge request apt-team/apt!365
| * | Only revoke weak RSA keys for now, add 'next' and 'future' levelsJulian Andres Klode2024-07-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Algorithms not in the next level give a warning, algorithms in not in the future level introduce an audit message for the --audit flag. next: >=rsa2048,ed25519,ed448,nistp256,nistp384,nistp512 future: >=rsa3072,ed25519,ed448 LP: #2073126
| * | gpgv: Add IsAssertedPubKeyAlgo() functionJulian Andres Klode2024-07-152-0/+33
| | | | | | | | | | | | This checks whether a public key algorithm is asserted.
| * | worker: Add an audit level to log audit messagesJulian Andres Klode2024-07-151-0/+5
| |/
* / solver3: Refactor Reason.Pkg()/Reason.Ver() use with iteratorJulian Andres Klode2024-07-162-6/+16
|/ | | | More code but nicer to read
* solver3: Formatting cleanupJulian Andres Klode2024-07-021-8/+8
| | | | Run clang-format
* solver3: Only demote obsolete packages in choices for upgradesJulian Andres Klode2024-07-021-2/+3
| | | | | If we are not upgraded, we should continue to keep the installed package installed if possible.
* solver3: Consider packages as obsolete and not versionsJulian Andres Klode2024-07-022-13/+26
| | | | | | | | | | | | | This makes more sense, as all package versions are obsolete that are not the candidate, usually. Pay special attention to no-strict-pinning: If we don't have strict pinning, a package without a candidate version may still be non-obsolete if the latest version is not obsolete. Likewise, in no-strict-pinning any later source version that exists will cause the package to be considered obsolete, rather than just candidates.
* solver3: Refactor (rewrite) FromDepCache()Julian Andres Klode2024-07-011-36/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the various Install requests into a single one and move some stuff around, this should be a bit easier to maintain and we don't repeat ourselves all the time. This accidentally uncovered some bugs in the code, that get fixed by this: - The UpgradeManual and InstallManual groups did not work correctly, Essential packages were Install and others were Upgrade. - Automatically installed packages falsely got promoted to the manual groups as they got promoted into the manual code path, whenever we ran without allowing their removal. - The combination of --mark-auto --auto-remove now works correctly We previously skipped the installation of automatically installed packages when we did autoremoval, but we did not consider if the action was protected, that is specified on the command-line. Now we do not autoremove protected actions, and have added a test case for it. - The AllowRemoveManual option no longer is applied if removals are generally denied. Closes: #1071519
* solver3: Unmark packages before setting any in ToDepCacheJulian Andres Klode2024-07-011-0/+2
| | | | | | We should set the Mark/Garbage flags for all packages so we don't end up in an inconsistent state, so reset the flags for each package before evaluating further.
* solver3: Do not accidentally promote Replaces and Enhances to dependenciesJulian Andres Klode2024-07-011-1/+3
| | | | | | | | | | As part of the refactoring, we allowed the code to work on unimportant dependencies as we needed to promote Suggests to Depends if they are currently satisfied. However, Replaces and Enhances were not considered properly and both are not negative dependencies so they were accidentally promoted to Depends too if they were currently satisfied.
* Merge branch 'edsp-source-version' into 'main'Julian Andres Klode2024-06-132-1/+15
|\ | | | | | | | | edsp: Parse source version from the Source-Version field See merge request apt-team/apt!354
| * edsp: Parse source version from the Source-Version fieldJulian Andres Klode2024-05-302-1/+15
| | | | | | | | | | | | | | | | | | EDSP uses the Source-Version field instead of storing the source version in the Source field with the package name, adjust our parser accordingly. Use the override in the edspLikeListParser to do so rather than dumb this into the correct place in the debListParser.
* | solver3: Order obsolete choices lastJulian Andres Klode2024-06-132-8/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has two aspects: 1. For a dependency A | B | C we order the obsolete packages last, that is, if A is obsolete, this gets reordered to B | C | A, such that we try to pick non-obsolete packages first to ease upgrade calculation. 2. When comparing two dependencies, we order dependencies into three groups: First we satisfy dependencies mentioning only non-installed (NEW) packages, then we satisfy "normal" dependencies, and finally we satisfy any dependencies mentioning obsolete packages. This means for example if you have obsolete libfoo1 and a new libfoo1t64, that we will see Depends: libfoo1t64 before any Depends: libfoo1 (which may expand to libfoo1 | libfoo1t64), so we effectively will have selected "replacement" packages this way already before getting to older packages where we would have to choose between the obsolete package and its replacement.
* | solver3: Remove no longer necessary comparisonsJulian Andres Klode2024-06-131-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | Comparing the size of work items is not strictly needed; we check if items have a single or no solution and propagate them early on, but it doesn't matter much if we solve A|B or C|D|E first. This will allow us to get rid of all the resizing business later on, and switch to using literal watching where we only watch one of the literals on the right hand side. Likewise, the upgrade case mattered initially in testing, but seems to have resolved itself.
* | solver3: Group work itemsJulian Andres Klode2024-06-132-27/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our backtracking is chronological, so we will first try alternative choices or skip optional items in later groups. So installing manually installed packages before automatically installed ones allows manually installed packages to remove automatically installed packages easily. If we did automatic packages first, we'd keep back upgrades for manual packages or change choices for their dependencies, or would have to backtrack harder to get back to the right decision level. That's silly. Ordering automatically installed packages last also allows us to calculate autoremovable packages. Since we will have installed all dependencies from manually installed packages by the point where we get to automatically installed packages, everything that will be installed in those Auto groups is inherently garbage.
* | solver3: Do not dump sizes that are clearly pointersJulian Andres Klode2024-06-131-1/+1
|/ | | | | | | | | We use a union here, but we don't know if we last stored a pointer, so let's just reject clearly non-sizes. Generally this will work fine -- you will not have enough choices in a dependency that you can construct a valid pointer to a Version*, especially given that any Version * > sizeof(pkgCache::Header) already, given it is in the cache.
* solver3: Fix translations of removals for marked installJulian Andres Klode2024-05-241-1/+1
| | | | | | | | | We also need to issue a MarkDelete() if the package is marked for installation currently but should not be, not only if it did not have a previous version. This fixes the final test in test-multiarch-barbarian, the others only needed adjustments to mark all packages as automatic.
* solver3: Actually restore unsolved items rather than solved onesJulian Andres Klode2024-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | When restoring previously solved items, we try to restore items that have become unsolved again by skipping items that have a solved solution. Well at least we thought we did, but we accidentally had a "not" in there that inverted the meaning, hence we lost work items on backtracking. This mostly did not seem to have caused any issues, I stumbled over it while trying to add `autoremove` listings to `upgrade`, but fixing it also fixes: test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings This used to say "E: Broken packages", meaning the solver lost a non-optional install request and the 2nd stage solver caught an incomplete solution. Also test-bug-735967-lib32-to-i386-unavailable restores the legacy solver behavior, so win win?
* solver3: Use stable sortJulian Andres Klode2024-05-241-5/+5
| | | | | | | | | | While it seems that libstdc++ is using stable_sort for sort, we should make this explicit: We don't want items in our queues to move ahead of earlier items of the same priority. i.e. consider dependencies, they are grouped by package, we don't want the sort algorithm to move B=2 ahead if A|B (which expands to A=2|A=1|B=2|B=1).
* solver3: Solve optional dependencies before optional packagesJulian Andres Klode2024-05-241-0/+2
| | | | | | | This somewhat improves reliability of not breaking Recommends, e.g. if the Recommends gets tightened. One test case enabled by this now is the test-resolver-provider-exchange, which with a simple change to allow removal of automatically installed packages works now.
* solver3: Promote satisfied Suggests to RecommendsJulian Andres Klode2024-05-241-20/+46
| | | | | | As per the test-suggests-promoted-to-recommends test. This is still a bit messy as we ignore alternative choices and only check the last one, but um seems useful?
* solver3: Try candidate before installed version on upgradeJulian Andres Klode2024-05-241-2/+9
| | | | | | | | | | This fixes --no-strict-pinning attempting to upgrade all the versions on the system. Adjust the upgrade test case accordingly: 1) no-strict-pinning pulls in systemd despite it being pinned down due to a dependenc (this was true before this fix) 2) no-strict-pinning does not pull in the upgrade-simple because nothing depends on it (this is what the test fixes)
* solver3: Implement APT::Solver::RemoveManual to allow removing manual packagesJulian Andres Klode2024-05-241-2/+5
| | | | | | This is mostly going to be useful for the test suite for now, implement a function there to set it up so we can use it to improve test suite correctness.
* edsp: solver3: Show some progressJulian Andres Klode2024-05-241-7/+16
| | | | | Ignore the Solving dependencies... line in the testing framework for compatibility with the existing test cases.
* pkgcachegen: Do not try to chmod or write to /dev/nullJulian Andres Klode2024-05-221-0/+4
| | | | | | | When -o Dir::Cache::pkgcache or -o Dir::Cache is set to /dev/null we accidentally changed its mode to 0666; which is certainly not intended. Avoid this issue by exiting the function early if the file specified is /dev/null.
* Deal better with spurious spaces in arch restrictionsDavid Kalnischkies2024-05-161-44/+41
| | | | | | | | 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
* Do not mark new if we have already installed providersDavid Kalnischkies2024-05-161-0/+19
| | | | | | | | | | | 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.
* Initial implementation of the 3.0 solverJulian Andres Klode2024-05-144-0/+1264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Allow parsing an empty Provides lineDavid Kalnischkies2024-04-261-1/+1
| | | | | | | | | | | | | If dpkg-gencontrol was involved in the creation of a package we will not usually encounter empty or otherwise useless fields, but apparently not everyone is using it. It isn't recommended to have these empty lines, but it isn't too hard to ignore for Provides as we did for dependencies already and apt-ftparchive can be convinced to produce empty files (if you feed it such a package) as well, so lets be nice and provide users with a more accepting parser. Closes: #1069874
* Do not upgrade rev-deps ear-marked for removalDavid Kalnischkies2024-04-241-2/+5
| | | | | | | | | | | | We schedule reverse dependencies for an upgrade, but we shouldn't do it if we have ear-marked this package for removal later on. Usually the solver will end up doing the right thing like it already did in the included testcase in the end, but given that before it reaches the right end it explored a bad path which can lead to more installs and removals influencing later decisions or are just too hard for the resolver to undo later on, we can just not explore this path to begin with. References: e077370ffcb3669a50a600e80356c2002e6b176d
* Do not ignore if a cmake execute_process failsDavid Kalnischkies2024-04-241-4/+8
| | | | | | Ignoring errors might lead to failures later on anyhow, but especially with triehash it could also lead to broken builds or other crazy stuff, so lets better be save than sorry.
* The text of notices and audits shall not be boldJulian Andres Klode2024-04-231-2/+4
| | | | | This turned out to be a bit too bold for most of them, given their informational nature.
* Add long-version message "Audit:" instead of "A:"Julian Andres Klode2024-04-221-1/+1
|
* Merge branch 'ui-2.9.2' into 'main'Julian Andres Klode2024-04-223-17/+44
|\ | | | | | | | | UI changes for 2.9.2 See merge request apt-team/apt!343
| * show: Highlight field names and colorize package nameJulian Andres Klode2024-04-192-11/+29
| | | | | | | | We should pass this properly to the TagSection.write()
| * i18n: Use Error:/Warning:/Notice: instead of E:/W:/N:Julian Andres Klode2024-04-191-5/+10
| | | | | | | | | | This allows these bits to be localized, improving user experience for users in different languages.
| * Keep the entire error/warning/notice message boldJulian Andres Klode2024-04-191-0/+4
| | | | | | | | | | This draws a bit more attention, and improves readability vs keeping the color for the entire message.
| * Render notices without (yellow) color, just in boldJulian Andres Klode2024-04-191-1/+1
| | | | | | | | Yellow is a bit odd for notices.
* | Add an audit message for missing InRelease filesJulian Andres Klode2024-04-191-0/+2
| |
* | Change the default log level from debug to noticeJulian Andres Klode2024-04-193-4/+4
| | | | | | | | | | | | | | | | | | | | We never used the debug level before, so we can do that. This allows us to have the new audit level. We did call DumpErrors() with DEBUG in two debug code paths, so don't touch those. debug
* | Add an "audit" error levelJulian Andres Klode2024-04-192-0/+30
|/ | | | | This will aggressively highlight out-of-compliance vs the best practices.
* Add APT::Configuration::color helper to colorize thingsJulian Andres Klode2024-04-192-0/+37
|