summaryrefslogtreecommitdiff
path: root/apt-private
Commit message (Collapse)AuthorAgeFilesLines
* solver3: Correctly deb822-escape error message in evaluation reportJulian Andres Klode2025-03-261-1/+3
| | | | | | The error messages are multi-line now, so need correct escaping. LP: #2104276
* Respect custom LESS/MORE/LV variablesJulian Andres Klode2025-03-261-1/+11
| | | | | | Use setenv() to avoid overriding user defined variables. LP: #2103921
* solver3: Avoid empty error message in evaluation crash reportJulian Andres Klode2025-03-201-3/+6
| | | | whoopsie does not accept empty values
* solver3: Use zstd-compressed, base64-encoded dumpsJulian Andres Klode2025-03-201-5/+14
| | | | | | | | | | | | | Store the solver dumps with zstd compression and base64-encode them in the crash report; such that they take up significantly less space and can fit in cassandra's schema. Base64 is wrapped at 76 characters as the base64 tool does. Do some magic std::string_view conversion to avoid string copies for the substr() used to get 76 characters at a time. Note we can rely on substr(i, 76) to handle less than 76 characters just fine; it uses std::min(76, size() - i) characters.
* solver evaluation: write minimized solver dumpsJulian Andres Klode2025-03-201-1/+1
| | | | These are faster to generate and significantly smaller.
* Print --solver 3.0 explanation if both internal and it failedJulian Andres Klode2025-03-091-0/+3
| | | | | | | | | | 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.
* Evaluate and fall back to the 3.0 solverJulian Andres Klode2025-03-091-86/+223
| | | | | | | | | | | | Always run the 3.0 solver after the internal solver. If the internal solver failed, and the 3.0 solver did not, use the 3.0 result. If 3.0 solver failed or produced a worse result than the internal solver, write an apport crash dump. We exclude situations which we now the solver can't handle, i.e. removals are forbidden and you requested removals, and stuff like that.
* string{=> _view} flNotDir(string{=> _view}). Configuration::{Cnd,}Set(Value: ↵наб2025-02-145-8/+9
| | | | string{=> _view})
* edit-sources: don't force .listChristopher Bock2025-02-071-2/+0
|
* modernize-sources: Avoid opening /dev/stdout for simulateJulian Andres Klode2025-02-041-5/+4
| | | | | | | /dev/stdout may not exist, so let's instead just reference the std::cout stream. Reported-by: h01ger on IRC
* Measure BootSize as integerJulian Andres Klode2025-02-031-2/+2
| | | | I don't know why I used a double here this is awkward.
* Also support debian-ports modernizationSamuel Thibault2025-02-021-1/+1
| | | | That just needs using '-' to replace spaces in Origin to get the keyring file name.
* Make notices about .list sources without signed-by less obnoxiousJulian Andres Klode2025-01-281-12/+29
|
* apt: Introduce the modernize-sources commandJulian Andres Klode2025-01-282-0/+225
| | | | | | | | | | | | | | | | | | | | | | This handles rewriting .list entries to .sources ones; the only options handled are - signed-by => Signed-By - trusted => Trusted The options to specify architectures, check-valid-until, etc. are not supported as they are not exposed in the code. We probably should refactor the parser at some point so we can actually read the parsed entry rather than the abstract objects we create from it. This can be improved further: - Keyrings from /etc/apt/trusted.gpg.d should be moved to /etc/apt/keyrings. - automatic detection by trying to verify using each keyring in trusted.gpg.d until we find the right one and then using that for Signed-By rather than leave some sources empty.
* apt-secure manual page is in manual section 8Andreas Rönnquist2025-01-281-1/+1
|
* Warn about missing Signed-By in .list formatJulian Andres Klode2025-01-211-1/+9
| | | | | | Warn about the missing field there and suggest the transition to deb822 .sources files if we found any non-deb822 source without signed-by.
* Drop SourceListWarnings::NonFreeFirmware messagesDavid Kalnischkies2025-01-051-129/+0
| | | | | | | | | They were implemented to help a tiny bit in notifying users even if they didn't read the Release notes (or didn't realize it would apply to them) that they likely have to change their sources.list entries, but that transition is now over for a while, so everyone who should have seen it has hopefully reacted to it and so all this code now does is waste space, time and idly waiting for false positives.
* Drop usage of APT_MUSTCHECKDavid Kalnischkies2025-01-051-1/+1
| | | | | nodiscard is a C++17 feature and already used (not just due to my recent changes) in our codebase, so lets drop the last remaining holdouts.
* Drop usage of macro APT_OVERRIDE for simple overrideDavid Kalnischkies2025-01-054-22/+21
| | | | | | | | | We were rather inconsistent in using it and as our public headers contain deduction guides (a c++17 feature) it seems silly to try to hide a c++11 feature in a macro, so lets stop this charade and drop the macro and while we are changing all these lines lets apply [[nodiscard]] (another c++17 feature) and other suggestions from clang-tidy and formatting for a little more consistency.
* apt show: Add pinning information for --fullJulian Andres Klode2024-12-191-0/+12
| | | | | Add new fields `APT-Pin`, `APT-Candidate`, and `APT-Release` to the output, same as in EDSP (limited to one release for now).
* Be more strict about which PAGER to execvp() directlyJulian Andres Klode2024-12-191-1/+3
| | | | | | | | | | | There could be | or ; or other stuff in PAGER that needs special handling, let's encode a list of known-good characters instead. This covers all known pagers. You could also try to execvp() PAGER in its entirety and if it fails with ENOENT fall back to the shell but then you don't get correct error handling if the pager really doesn't exist (in which case we should abort trying to page).
* Introduce automatic pager for read commandsJulian Andres Klode2024-12-187-4/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Automatically show the output of `show`, `policy`, `list`, `search`, `showsrc` in a pager. The pager setup is inspired by git's pager setup. Notably, the pager is found using APT_PAGER and PAGER variables. We wait for the pager to be setup somewhat correctly by using a notify pipe to figure out whether execvp() was succesful - then the pipe will read EOF as the other end got closed by CLOEXEC during exec - or not, then the pipe will contain an errno. We set up the correct handlers for signals and exit to close the fds and wait for the pager. Notably inside the signal handler we cannot flush our streams, only close them, so there is some duplication. We call the InitOutputPager() function from inside the various Do...() functions rather than setting it up generally in InitOutput(). Doing so allows us to first render the progress without a pager, and then setup the pager for the content only which improves user experience. When we setup a pager we also take care to disable standard input, as we should not be prompting users while a pager is running (the pager will be reading from the tty directly). We do this by dup2-ing() a /dev/null over it; if we just close()d the fd, another open() might reuse the fd number and problems could occur.
* Collect unprinted Ign errors for display in Err outputDavid Kalnischkies2024-11-222-17/+44
| | | | | | | | | | | | | | | | Instead of deciding if the first or the last error in a retry chain is the best one to display if the entire chain fails in the end we teach our progress reporting to collect the ignored errors (if it hasn't shown them) and print them all together in the Err line. We de-duplicate the collection which makes it harder to match the Ign line with the error messages, but for these cases its probably better to enable direct display of the text anyhow – and repeating the same message multiple times is boring and probably not that helpful for a user wanting to know why all the downloads failed even they asked apt to retry 429 times… References: 841243df877b39dfcb907a7fab9c4e8b4f65d715
* Add a virtual destructor to private CacheSet MatcherDavid Kalnischkies2024-11-221-0/+1
| | | | | This silences the warning: | warning: ‘class Matcher’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
* Acknowledge non-erase usage of remove_if for volatile sourcesDavid Kalnischkies2024-11-221-1/+1
| | | | | | | | | | | | | gcc produces a length warning starting with: | warning: ignoring return value of ‘_FIter std::remove_if(_FIter, _FIter, _Predicate) [with …]’, declared with attribute ‘nodiscard’ [-Wunused-result] which is usually correct, but in the usage here we don't want to call an erase as we operate on a c-style new[] array here which contains pointers into argv and has an explicit sentinel (nullptr) – FileSize() is based on this sentinel. Casting to void silences the warning as is standard practice and hopefully indicates better that this is intended than ignoring the warning for the casual on-looker.
* Add a --comment option to record Comment: in historyJulian Andres Klode2024-11-181-0/+1
| | | | Suggested-by: mhoye on IRC
* Merge branch 'svequiv' into 'main'Julian Andres Klode2024-11-141-1/+1
|\ | | | | | | | | Internally replace APT::StringView with std::string_view where it doesn't affect the ABI, with implementations that support both std::string_view and APT::StringView with new shims. ReportMirrorFailureToCentral: fix use-after-free See merge request apt-team/apt!394
| * apt-private/private-update.cc: APT::StringView -> std::string_viewнаб2024-11-121-1/+1
| |
* | Merge branch 'json-config' into 'main'Julian Andres Klode2024-11-141-1/+33
|\ \ | |/ |/| | | | | JSON: Pass options to hooks in hello message See merge request apt-team/apt!389
| * json: Add "options" array to JSON hooksJulian Andres Klode2024-11-121-1/+33
| | | | | | | | | | See the attached documentation. Note that defaults are missing, so using this is not particularly easy so far.
* | Replace std::bind with lambdasнаб2024-11-112-4/+4
|/
* Merge branch 'feature/ignorantprompt' into 'main'Julian Andres Klode2024-10-221-1/+9
|\ | | | | | | | | Ignore pending input before confirmation prompts See merge request apt-team/apt!375
| * Show prompt reply if input is from non-terminalDavid Kalnischkies2024-09-291-1/+2
| | | | | | | | | | | | | | | | In the unlikely case input is not a terminal (but not in some way assumed with command line flags) we should print the string we act on after the prompt so that people can see what is happening rather than having the prompt "mysteriously" hidden on terminals or prepended to the first line of the download progress in logs.
| * Ignore pending input before confirmation promptsDavid Kalnischkies2024-09-291-0/+7
| | | | | | | | | | | | | | | | | | | | Pressing ENTER for too long lets it end up in the input buffer which the confirmation prompt happily picks up and accepts as confirmation for deleting potentially half your system or doing other silly things. Ironically, this confirmation will also be silent in terms of output as it is likely erased by future progress reporting. Closes: #1082956
* | Support --target-release in `apt list`Raziel Anarki2024-10-221-0/+2
|/
* Add note that redundant 'CLI interface' is intentionalJulian Andres Klode2024-07-281-0/+2
|
* Parse snapshot option for apt show/listDavid Kalnischkies2024-07-081-0/+2
| | | | | | | | | | | | | The option is supported by the command (as this is done by a bit more low level code), but the command line parsing did not expect them to be used for the apt show & list command, so that it would report error. As such, a workaround for this issue is to use: -o APT::Snapshot=BANANA instead of e.g. -S BANANA Closes: #1075819
* Show installed version (not candidate version) while removing a packagesid2024-07-053-2/+12
| | | | | Showing a package version which was never installed in removals is confusing.
* Do not save new if we have already installed providersDavid Kalnischkies2024-05-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Initial implementation of the 3.0 solverJulian Andres Klode2024-05-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Separate columns by 2 spaces in listsJulian Andres Klode2024-04-301-1/+1
| | | | | | | This improves readability a bit more as it's visually easier to tell " " and "-" apart than " " and "-". Closes: #1070064
* Merge branch 'src-specifier' into 'main'Julian Andres Klode2024-04-292-4/+18
|\ | | | | | | | | showsrc, source, build-dep: Support src:name See merge request apt-team/apt!346
| * source, build-dep: Allow specifying src:nameJulian Andres Klode2024-04-291-1/+7
| | | | | | | | This has the same behavior as --only-source name.
| * showsrc: Support querying src:nameJulian Andres Klode2024-04-291-3/+11
| | | | | | | | This has the same meaning as --only-source name
* | Match version constraints before saving garbage packagesDavid Kalnischkies2024-04-241-6/+14
| | | | | | | | | | | | | | | | | | We remove new garbage packages from the solution if we can as installing a new package which is at the same time considered garbage looks silly, but it could also be a new dependency of another garbage package, so we have a second round trying to save such packages. In this round we weren't considering versioned constraints on dependency relations through so even an unsatisfied old recommends could save which it shouldn't.
* | Avoid figuring which kept pkgs are phased if we don't display itDavid Kalnischkies2024-04-241-10/+10
|/ | | | | | | Not all commands show kept back packages, so even if it hardly matters, lets not crunch numbers needlessly if we don't need the info which also reduces the lifetime of the involved variables hopefully also reducing the mental requirements for a reader.
* Highlight essential removals with action::remove colorJulian Andres Klode2024-04-231-1/+1
|
* Merge branch 'ui-2.9.2' into 'main'Julian Andres Klode2024-04-226-17/+36
|\ | | | | | | | | UI changes for 2.9.2 See merge request apt-team/apt!343
| * Show "Upgrading:" before other sectionsJulian Andres Klode2024-04-191-2/+2
| | | | | | | | | | | | This avoids awkward interactions with Installing dependencies and Suggested packages appearing before it; despite being triggered by it.
| * Insert blank line following simulation noteJulian Andres Klode2024-04-191-0/+2
| |