summaryrefslogtreecommitdiff
path: root/apt-private
Commit message (Collapse)AuthorAgeFilesLines
* apt: push to emplace C++11 if possibleHerman Semenoff2026-04-081-4/+4
| | | | | | References: - https://www.reddit.com/r/cpp_questions/comments/pm63yx/why_clangtidy_says_use_emplace_back_instead_of/ - https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-emplace.html
* apt: funcs called with a string literal consisting of a single characterHerman Semenoff2026-04-082-8/+8
| | | | | | | | Benchmark: - https://stackoverflow.com/questions/62058906/why-my-performance-benchmark-gives-me-wrong-results References: - https://clang.llvm.org/extra/clang-tidy/checks/performance/prefer-single-char-overloads.html
* Drop warning about unstable CLI interfaceJulian Andres Klode2026-04-072-20/+0
| | | | | | | | A specific CLI version can now be requested using the --cli-version flag, and old versions can be deprecated on a reasonable cadence. Therefore, a warning is no longer necessary. Gbp-Dch: full
* Change GetKindString to not use .data() callSimon Johnsson2026-04-071-1/+1
|
* Optimize ShortenCommandSimon Johnsson2026-04-071-9/+13
|
* Scale history-list to screen widthSimon Johnsson2026-04-071-31/+67
|
* apt-private/private-download.cc: support unlimited space tmpfsJohannes Schauer Marin Rodrigues2026-01-051-14/+14
| | | | | | | | | | | | | | | | | | Test like this: sudo mount -t tmpfs -o size=0 tmpfs rootfs cat << 'END' > run.sh set -exu export LD_LIBRARY_PATH=/home/josch/git/apt/build/apt-pkg mkdir -p "$1/etc/apt" "$1/var/cache" "$1/var/lib/dpkg/" echo "Dir \"$(cd "$1" && pwd)\";" > "$1/apt.conf" echo "deb [signed-by=/usr/share/keyrings/debian-archive-keyring.pgp] http://deb.debian.org/debian/ unstable main" > "$1/etc/apt/sources.list" APT_CONFIG="$1/apt.conf" build/cmdline/apt-get update APT_CONFIG="$1/apt.conf" build/cmdline/apt-get --yes --download-only install '?essential' END ./run.sh rootfs
* A special cow for a special weekJulian Andres Klode2025-11-101-2/+8
|
* Fix missing includesRuoyu Zhong2025-10-281-0/+2
| | | | | | | | | | | | | | | | | | | | | This was missed in 4b22a1e36 (apt-team/apt!522), and caused the following error when built with GCC 12: /var/tmp/apt-20251026-9687-pc954n/apt-3.1.10/apt-private/private-cmndline.cc:544:23: error: ‘optional’ is not a member of ‘std’ 544 | static std::pair<std::optional<long unsigned int>, std::optional<long unsigned int>> parseCliVersion(std::string_view version) | ^~~~~~~~ /var/tmp/apt-20251026-9687-pc954n/apt-3.1.10/apt-private/private-cmndline.cc:27:8: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’? 26 | #include <apti18n.h> +++ |+#include <optional> 27 | /*}}}*/ While at it, also add missing <utility> include for std::pair. Discovered in https://github.com/Homebrew/homebrew-core/pull/251162 by Anton Melnikov. Co-authored-by: Anton Melnikov <antonsm21@gmail.com> Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
* Enable the new solver by default in 0.31, 1.21, 2.11, 3.1Julian Andres Klode2025-10-251-0/+4
| | | | | Enable the new solver by default and remove the vendor-specific configuration change in Ubuntu's drop-in.
* Record varying defaults based on cli-version, rather than binaryJulian Andres Klode2025-10-253-26/+112
| | | | | | The --cli-version argument can be used to request a specific CLI version. The default CLI version is the APT version for apt(8) and 0 for the other apt-get tools.
* Let APT::Get::Mark-Auto satisfy APT::Get::Build-Dep-AutomaticJochen Sprickerhof2025-10-071-1/+1
| | | | | | | | This allows: apt build-dep --mark-auto apt Closes: #973260
* Fix history command error when no ID was givenSimon Johnsson2025-10-061-0/+2
|
* Add history undo, redo, and rollback featuresSimon Johnsson2025-10-022-12/+284
|
* history-list: reject any arguments providedJulian Andres Klode2025-09-261-0/+3
|
* history: Handle transactions without any changesJulian Andres Klode2025-09-261-1/+2
| | | | For some reason I have them in my log file.
* History Command and ParsingSimon Johnsson2025-09-262-0/+250
|
* Fail on stdio errorsDemi M. Obenour2025-05-191-1/+1
| | | | | | If there is an error writing to cout, cerr, or clog, APT should return a non-zero exit code. This allows automated tools to reliably check for warnings.
* 💬 Recommend use of `apt update` over `apt-get update`Max Coplan2025-05-191-2/+2
|
* Remove unused variable in apt-privateJulian Andres Klode2025-04-041-1/+0
|
* solver3: Consider more upgrades more costly when not upgradingJulian Andres Klode2025-04-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | We inadvertently considered more upgrades as a better solution in all cases, but if we are *installing* rather than upgrading, we should count upgrades as a negative. Change the code to accomodate that. This requires a few more tricks: - We remove the keep count check. This does not appear to work correctly and would have prevented the fix. We are already counting all possible changes, so why bother. - We need to subtract the upgrade count from the install count (upgrades are a class of installs) since we now allow comparing solutions with different upgrade counts for install counts. - After comparing the "new install count", we now compare upgrade count too, in the opposite direction of upgrading. To test, we abuse that solver 3.0 does not upgrade all packages in a source package when using the install command. LP: #2105395
* 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