summaryrefslogtreecommitdiff
path: root/cmdline
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-081-1/+1
| | | | | | | | 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-071-1/+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
* solver3: Extract DependencySolverJulian Andres Klode2026-01-051-1/+1
| | | | Extract almost all dependency logic into a subclass
* solver3: Refactor to use a namespaceJulian Andres Klode2026-01-051-1/+1
| | | | | | | This removes the need for the forward references, thus fixing part of the libc++ issues pointed out in [merge-511]. [merge-511] https://salsa.debian.org/apt-team/apt/-/merge_requests/511/diffs
* fix compiling with muslGyorgy Sarvari2025-10-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | In case apt is compiled against musl-libc, then compilation fails with the following error: cmdline/apt-internal-solver.cc:122:20: error: 'basename' was not declared in this scope; did you mean 'rename'? | 122 | if (strcmp(basename(argv[0]), "solver3") == 0) | | ^~~~~~~~ | | rename To fix it, include libgen header where musl can find this function also. Once this is fixed, compilation fails once again with musl-libc, because the basename function takes *char argument instead of const *char: this is because the musl implementation cuts off the trailing slashes of the path, in case the argument is a folder path. To account for this, instead of passing argv[0] directly, create a non-const string copy of it, and pass that to base. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
* Add history undo, redo, and rollback featuresSimon Johnsson2025-10-021-0/+3
|
* History Command and ParsingSimon Johnsson2025-09-261-8/+12
|
* Introduce apt why, apt why-notJulian Andres Klode2025-05-191-0/+17
| | | | | | | | | | | These are implemented somewhat differently from aptitudes why and why-not commands: They produce the actual solver trace for why a particular decision has been taken. For the why-not case, we need to explicitly discover our specified package, as if nothing else depends on it in our graph, it would otherwise always be undiscovered and conflicts not detected (see e.g. level-3 in the test).
* cmdline/apt-get.cc: emit Signed-By field and support $(SIGNED_BY) in apt-get ↵Johannes Schauer Marin Rodrigues2025-03-141-0/+2
| | | | indextargets --format
* refactor: Deduplicate and Move SectionInSubTree to ConfigurationJulian Andres Klode2025-02-181-35/+1
| | | | | Deduplicate the copies in a central one, mark it unavailable to external users.
* cache: Introduce partial SourceVersion supportJulian Andres Klode2025-02-151-14/+17
| | | | | | | | | | | | This is the first step that introduces a 1:1 mapping between version and source version. In a future version this can use the fields currently marked unavailable to deduplicate the SourceVersion objects across the group. The policy gains a member for storing pins for sourceversions. Together, in the future we should be able to determine candidates for source versions.
* Record all available sources for descriptionsDavid Kalnischkies2025-01-301-3/+4
| | | | | | | | | | | | Avoiding duplications is one thing, but it could also be handy to know all sources for a description so that you can e.g. avoid opening another file or similar such if its also present in one you already have open. Given how the structures were set up this was probably intended all along and either worked at some point or was abandoned for the duplicates that we started culling heavily with the introduction of MultiArch as at that point they blew up the cache and needed to be dealt with.
* Drop unused version stanza size info from binary cacheDavid Kalnischkies2025-01-301-31/+19
| | | | | | | | | | | | | | Same reason as with the description size before, but this one had actually one extremely dated user in src:apt left with dumpavail, which is changed to an implementation that is (in comparison) a bit slower, but should be good enough for a command that is ideally not used anymore (even if codesearch suggests otherwise). After all, what makes this a bit slower is not that we don't know the size, but that this one does additional work preparing for accessing the fields which we don't do. In exchange pkgTagFile has a better implementation for "Jitter" than the old code that we would "just" need to copy here if speed were really an issue.
* apt: Introduce the modernize-sources commandJulian Andres Klode2025-01-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* Drop APT_NORETURN usageDavid Kalnischkies2025-01-052-2/+2
| | | | | [[noreturn]] is a C++11 feature and so we can just use it unconditionally.
* Drop usage of macro APT_OVERRIDE for simple overrideDavid Kalnischkies2025-01-053-11/+11
| | | | | | | | | 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-helper: Add a hash-file helper to debug file hashingJulian Andres Klode2024-12-211-10/+41
|
* Stop installing apt-key, make it a test suite helperJulian Andres Klode2024-12-072-851/+0
|
* apt-key: Temporarily accept 'pub' as an extension for binary gpg keysJulian Andres Klode2024-11-281-1/+1
|
* apt-key: Only cat supported keyrings into the merged oneJulian Andres Klode2024-11-281-1/+3
|
* apt-key: Prefer gpgv-sq if it existsJulian Andres Klode2024-11-221-0/+1
| | | | | This allows you to test out gpgv-sq by just installing it, which is nice.
* cmdline/apt-sortpkgs.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-15/+15
|
* cmdline/apt-extracttemplates.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-15/+15
|
* Turn std::unique_ptr<char[]/std::array<char>>(APT_BUFFER_SIZE) buffers into ↵наб2024-11-111-4/+5
| | | | std::array<char, APT_BUFFER_SIZE>
* Move apt-extracttemplates to /usr/lib/apt in 'apt' packageJulian Andres Klode2024-11-111-2/+1
| | | | | | | | | This is useful on every system and only was in apt-utils for historical reasons. Move it to the main apt package, and also move it out of the path. Add a symbolic link in /usr/bin to apt-utils and keep the manual pages in tere.
* Check gpgv --dump-options for --assert-pubkey-algo supportJulian Andres Klode2024-06-131-12/+2
| | | | | | | This avoids the fragile --help check. This option is not documented in the manual page but seems to be there. Thanks: Justus Winter for the idea
* EDSP: Add "solver3" alias for apt-internal-solverJulian Andres Klode2024-05-142-1/+5
| | | | | This invokes the 3.0 solver. It has a nicer name for a binary, matching the communicated codename.
* Update Graphviz URL to https://graphviz.org/Wesley Schwengle2024-03-141-1/+1
| | | | Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
* Implement gpgv --assert-pubkey-algo=>=rsa2048,ed25519,ed448Julian Andres Klode2024-02-281-3/+18
| | | | | | | | | | | | The assertion can be overriden using apt::key::assert-pubkey-algo, the default is the most opinionated one. This will inform the user during apt-cdrom add as we do not pass --quiet to user, so adjust test case. Add a simple test case for it to test-method-gpgv. LP: #2055193
* Modernize standard library includesJulian Andres Klode2024-02-2010-25/+25
| | | | | | This was automated with sed and git-clang-format, and then I had to fix up the top of policy.cc by hand as git-clang-format accidentally indented it by two spaces.
* Merge branch 'apt-key-handle-crlf-keyrings' into 'main'Julian Andres Klode2024-02-201-1/+2
|\ | | | | | | | | apt-key: remove carriage returns from armored keyrings before dearmoring See merge request apt-team/apt!309
| * apt-key: remove carriage returns from armored keyrings before dearmoringKenyon Ralph2023-11-291-1/+2
| | | | | | | | | | | | | | Without this, the awk script returns nothing if the armored keyring uses Windows/DOS-style CRLF line endings (since awk is designed for processing Unix text files). This would result in a NO_PUBKEY error during the signature verification part of an apt-get update.
* | Improve and test distclean implementationDavid Kalnischkies2024-01-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The implementation as-is as various smaller/esoteric bugs and inconsistencies like apt-get not supporting them, the option -s being supported in code but not accepted on the command line, the regex not escaping the dot before the file extension and exposing more implementation details to public headers than we actually need. Also comes with a small test case to ensure it actually works. References: bd7c126e3fb1b94e76e0e632c657cea854586844
* | Merge branch 'fix-959093' into 'main'Julian Andres Klode2023-12-081-0/+2
|\ \ | |/ |/| | | | | Add 'dist-clean' command to remove packages and list files See merge request apt-team/apt!290
| * Add 'dist-clean' command to remove packages and list filesGábor Németh2023-11-221-0/+2
| | | | | | | | | | | | | | We assume all files in the 'listsdir' are candidates. Keep only files ending with Release, Release.gpg, and InRelease. Closes: #959093
* | Use a more gitignore style matchingJulian Andres Klode2023-02-271-2/+2
|/ | | | | | | | Use a rightmost match for / so that if we end up with a Section: a/b/c, a 'c' matcher still matches. If the section does not contain any /, it can be matched using /pattern, e.g. /c only matches Section: c, but not Section: a/b/c.
* Have values in Section config trees refer to them in all componentsDavid Kalnischkies2023-01-301-10/+23
| | | | | | | | | | | | | | | | | | Hard coding each and every component is not only boring but given that everyone is free to add or use more we end up in situations in which apt behaves differently for the same binary package just because metadata said it is in different components (e.g. non-free vs. non-free-firmware). It is also probably not what the casual user would expect. So we instead treat a value without a component as if it applies for all of them. The previous behaviour can be restored by prefixing the value with "<undefined>/" as in the component is not defined. In an ideal world we would probably use "*/foo" for the new default instead of changing the behaviour for "foo", but it seems rather unlikely that the old behaviour is actually desired. All existing values were duplicated for all (previously) known components in Debian and Ubuntu.
* improve `--help` text for cmdline `apt autoremove`Camiel Vletter2022-12-131-1/+1
|
* Documentation for autopurge commandquazgar2022-10-282-0/+2
|
* Use pkgTagSection::Key in more places in src:aptDavid Kalnischkies2022-04-012-7/+9
| | | | | | | | | | The speed critical paths were converted earlier, but the remaining could benefit a tiny bit from this as well especially as we have the facility now available and can therefore brush up the code in various places in the process as well. Also takes the time to add the hidden Exists method advertised in the headers, but previously not implemented.
* Warn if the legacy trusted.gpg keyring is used for verificationJulian Andres Klode2022-02-221-0/+3
| | | | | With apt-key going away, people need to manage key files, rather than keys, so they need to know if any keys are in the legacy keyring.
* Fix "was already not hold" message grammarVille Skyttä2022-01-241-1/+1
|
* Use short options for cmpWalter Lozano2021-11-261-3/+3
| | | | | | | | In order to be consistent with other uses of cmp and to improve compatiblity with other implementations, like busybox one, change long options to short ones. Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
* Use `command -v` instead of `which`Ville Skyttä2021-11-041-12/+1
| | | | | | | | | | `which` has been deprecated in debianutils 5.0+. The recommended replacement, `command -v`, is mandated by Debian policy these days, in addition to being required by POSIX and its predecessor specs at least since 1994. Not found commands cause no output from `command -v` per POSIX, so remove the redundant 2>&1's while at it.
* Inhibit autoremove calculation in apt-mark and apt showDavid Kalnischkies2021-08-281-0/+4
| | | | | | | As we never display the information in these code paths there isn't a lot of point in calculating it first saving us some precious CPU cycles. References: d6f3458badf2cfea3ca7de7632ae31daff5742be
* Merge branch 'pu/upgradecounter' into 'main'Julian Andres Klode2021-04-291-2/+7
|\ | | | | | | | | Count uninstallable packages in "not upgraded" See merge request apt-team/apt!169
| * Count uninstallable packages in "not upgraded"David Kalnischkies2021-04-251-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a first step of the solver can figure out that a package is uninstallable it might reset the candidate so that later steps are prevented from exploring this dead end. While that helps the resolver it can confuse the display of the found solution as this will include an incorrect count of packages not upgraded in this solution. It was possible before, but happens a fair bit more with the April/May resolver changes last year so finally doing proper counting is a good idea. Sadly this is a bit harder than just getting the number first and than subtracting the packages we upgraded from it as the user can influence candidates via the command line and a package which could be upgraded, but is removed instead shouldn't count as not upgraded as we clearly did something with it. So we keep a list of packages instead of a number which also help in the upgrade cmds as those want to show the list. Closes: #981535
* | Call MarkAndSweep only manually in apt-get for autoremoveDavid Kalnischkies2021-04-261-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | An interactive tool like aptitude needs these flags current far more often than we do as a user can see them in apt only in one very well defined place – the autoremove display block – so we don't need to run it up to four times while a normal "apt install" is processed as that is just busywork. The effect on runtime is minimal, as a single run doesn't take too long anyhow, but it cuts down tremendously on debug output at the expense of requiring some manual handholding. This is opt-in so that aptitude doesn't need to change nor do we need to change our own tools like "apt list" where it is working correctly as intended. A special flag and co is needed as we want to prevent the ActionGroup inside pkgDepCache::Init to be inhibited already so we need to insert ourselves while the DepCache is still in the process of being built. This is also the reason why the debug output in some tests changed to all unmarked, but that is fine as the marking could have been already obsoleted by the actions taken, just inhibited by a proper action group.
* Proper URI encoding for config requests to our test webserverDavid Kalnischkies2020-12-181-0/+9
| | | | | | Our http method encodes the URI again which results in the double encoding we have unwrap in the webserver (we did already, but we skip the filename handling now which does the first decode).