summaryrefslogtreecommitdiff
path: root/apt-private
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'feature/barbarianarchs' into 'main'Julian Andres Klode2021-10-181-13/+12
|\ | | | | | | | | Streamline access to barbarian architecture functionality See merge request apt-team/apt!184
| * Streamline access to barbarian architecture functionalityDavid Kalnischkies2021-09-041-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | APT is not the place this information should be stored at, but it is a good place to experiment and see what will be (not) needed in the future for a proper implementation higher up the stack. This is why "BarbarianArchitectures" is chosen instead of a more neutral and/or sensible "VeryForeign" and isn't readily exported in the API to other clients for this PoC as a to be drawn up standard will likely require potentially incompatible changes. Having a then outdated and slightly different implementation block a "good" name would be bad. The functionality itself mostly exists (ignoring bugs) since the introduction of MultiArch as we always had the risk of encountering packages of architectures not known to dpkg (forced onto the system, potentially before MultiArch) we had to deal with somehow and other edge cases. All this commit really does is allowing what could previously only be achieved with editing sources.list and some conf options via a single config option: -o APT::BarbarianArchitectures=foo,bar
| * Do not strip M-A for native build-dep resolutionDavid Kalnischkies2021-09-041-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back than M-A was added to build-dependencies (#558104) only the qualifiers :native and :any were considered at first which for the native case behave the same, so stripping was a good idea. Nowadays we could encounter arch-qualified dependencies, too, through – or slightly more likely conflicts perhaps – at least in theory as in practice native build-dep operations in Debian and elsewhere wouldn't have other architectures available anyhow. Still, we have full support for all this for the crossbuilding case which makes active use of this (at least is far more likely to do so), so it seems better to converge on one edgecase rather than keeping two in active use and so produce potentially different results for not specifying -a and -a $native.
* | Inhibit autoremove calculation in apt-mark and apt showDavid Kalnischkies2021-08-281-0/+1
|/ | | | | | | 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
* Bump to C++17Julian Andres Klode2021-08-091-1/+1
| | | | | Comparison operators need to be const-invocable now, but otherwise no change seems necessary.
* Check sources.list could be parsed before adding volatile filesJulian Andres Klode2021-07-011-0/+2
| | | | | | | We just used the pointer returned which might be nullptr, properly call BuildSourceList() and check the result first. Closes: #990518
* Do not use filename of local sources in 'apt download'David Kalnischkies2021-06-041-6/+10
| | | | | | | | | | If a source is not copying files to the destination the download code forces the copy – which in practice are local repositories accessed via file:/ – but in that process takes the filename the local repo used rather than the filename it e.g. advertised via --print-uris. A local repository could hence override a file in the current directory if you use 'apt download', which is a rather weak ability, but still.
* Temporarily Revert "2.3-only: Warn that the 0.1 protocol is deprecated"Julian Andres Klode2021-04-291-1/+0
| | | | This reverts commit 64127478630b676838735b509fec5cdfa36874c8.
* Merge branch 'pu/upgradecounter' into 'main'Julian Andres Klode2021-04-296-37/+82
|\ | | | | | | | | Count uninstallable packages in "not upgraded" See merge request apt-team/apt!169
| * Count uninstallable packages in "not upgraded"David Kalnischkies2021-04-256-37/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-262-8/+16
|/ | | | | | | | | | | | | | | | | | | | | | | 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.
* Avoid infinite loop on EOF on media change promptJulian Andres Klode2021-04-231-1/+3
| | | | | | The code missed a break, so it was looping infinitely because the while loop condition only checked for '\n' and '\r', but not end of file.
* 2.3-only: Warn that the 0.1 protocol is deprecatedJulian Andres Klode2021-04-231-0/+1
|
* json: Hook protocol 0.2 (added upgrade,downgrade,reinstall modes)Julian Andres Klode2021-04-231-9/+40
| | | | | | | | | Hook protocol 0.2 makes the new fields we added mandatory, and replaces `install` mode with `upgrade`, `downgrade`, `reinstall` where appropriate. Hook negotiation is hacky, but it's the best we can do for now. Users are advised to upgrade to 0.2
* json: Add `package-list` and `statistics` install hooksJulian Andres Klode2021-04-234-11/+21
| | | | This enables hooks to output additional information.
* upgrade: Add JSON hook support (AptCli::Hooks::Upgrade)Julian Andres Klode2021-04-231-3/+13
|
* json: Add origins fields to versionJulian Andres Klode2021-04-231-0/+35
| | | | | | Provide access to the origins of a package, such that tools can display information about them; for example, you can write a hook counting security upgrades.
* json: Flush standard file descriptors before calling hooksJulian Andres Klode2021-04-231-0/+8
| | | | This ensures messages are displayed in the correct order.
* json: Encode NULL strings as nullJulian Andres Klode2021-04-231-1/+4
| | | | This is the only nullable thing we have here.
* json: Actually pop statesJulian Andres Klode2021-04-231-0/+1
| | | | | | | | | | | The JSON encoder only looked at the top state, but did not pop it, so if we nested objects, we got stuck in whatever the last state we pushed aside was, so in our example, we wrongly get a comma inserted _after_ key "b": {"a":[{}], "b":,[{}] }
* json: Escape strings using \u escape sequences, add testJulian Andres Klode2021-04-231-4/+20
| | | | | | | | This allows us to correctly encode strings containing quotation marks, escape characters and control characters. The test case is a bit nasty because it embeds private-cachefile.cc for linkage reasons.
* Implement update --error-on=anyJulian Andres Klode2021-01-081-0/+1
| | | | | | | | | | | People have been asking for a feature to error out on transient network errors for a while, this gives them one while keeping the door open for other modes we need, such as --error-on=no-success which we need to determine when to retry the daily update job. Closes: #594813 (and a whole bunch of duplicates...)
* Add support for Phased-Update-PercentageJulian Andres Klode2021-01-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for Phased-Update-Percentage by pinning upgrades that are not to be installed down to 1. The output of policy has been changed to add the level of phasing, and documentation has been improved to document how phased updates work. The patch detects if it is running in a chroot, and if so, always includes phased updates, restoring classic apt behavior to avoid behavioral changes on buildd chroots. Various options are added to control this all: * APT::Get::{Always,Never}-Include-Phased-Updates and their legacy update-manager equivalents to always or never include phased updates * APT::Machine-ID can be set to a UUID string to have all machines in a fleet phase the same * Dir::Etc::Machine-ID is weird in that it's default is sort of like ../machine-id, but not really, as ../machine-id would look up $PWD/../machine-id and not relative to Dir::Etc; but it allows you to override the path to machine-id (as opposed to the value) * Dir::Bin::ischroot is the path to the ischroot(1) binary which is used to detect whether we are running in a chroot.
* Only autoremove kernels in apt(8); respect --no-auto-removeJulian Andres Klode2021-01-082-4/+3
| | | | | | | | | | | | Automatically removing kernels in apt-get could be unexpected, so limit it to apt for now. To handle --no-auto-remove correctly, rewrite the hack that makes apt ignore APT::Get::AutomaticRemove options from config files such that it unsets the option. This then means we can do FindB("APT::Get::AutomaticRemove", true) as the default for APT::Get::AutomaticRemove::Kernels and get the behavior we want: If you set --no-auto-remove, it is respected as that FindB returns false; if you don't set it, it will be true.
* Automatically remove unused kernels on dist-upgradeJulian Andres Klode2021-01-041-1/+11
| | | | | Kernels clutter /boot and /boot is small size, so we need to take extra care to remove kernels when possible.
* Support compressed output from rred similar to apt-helper cat-filefeature/rredDavid Kalnischkies2020-11-071-0/+1
|
* Prepare rred binary for external usageDavid Kalnischkies2020-11-073-1/+12
| | | | | | | | | | | Merging patches is a bit of non-trivial code we have for client-side work, but as we support also server-side merging we can export this functionality so that server software can reuse it. Note that this just cleans up and makes rred behave a bit more like all our other binaries by supporting setting configuration at runtime and supporting --help and --version. If you can make due without this, the now advertised functionality is provided already in earlier versions.
* Merge branch 'master' into 'master'Julian Andres Klode2020-08-041-0/+1
|\ | | | | | | | | Support marking all newly installed packages as automatically installed See merge request apt-team/apt!110
| * Support marking all newly installed packages as automatically installedNicolas Schier2020-06-081-0/+1
| | | | | | | | | | | | | | Add option '--mark-auto' to 'apt install' that marks all newly installed packages as automatically installed. Signed-off-by: Nicolas Schier <nicolas@fjasle.eu>
* | Replace whitelist/blacklist with allowlist/denylistJulian Andres Klode2020-08-041-1/+1
|/
* private-search: Only use V.TranslatedDescription() if goodJulian Andres Klode2020-05-181-1/+1
| | | | | | | | | | | When we could not find a translated description, we were pushing V.TranslatedDescription() to the vector, but that one might not have been good either. Add the check so we don't crash later when trying to access it. LP: #1877987
* apt list: Fix behavior of regex vs fnmatch vs wildcardsJulian Andres Klode2020-05-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | Previously (and still in cacheset), patterns where only allowed to start with ? or ~, which ignores the fact that a pattern might just as well start with a negation, such a !~nfoo. Also, we ignored the --regex flag if it looked like this, which was somewhat bad. Let's change this all: * If --regex is given, arguments are always interpreted as regex * If it is a valid package wildcard (name or * characters), then it will be interpreted as a wildcard - this set of characters is free from meaningful overlap with patterns. * Otherwise, the argument is interpreted as a pattern. For a future version, we need to adapt parsing for cacheset and list to use a common parser, to avoid differences in their interpretation. Likely, this code will go into the pattern parser, such that it generates a pattern given a valid fnmatch argument for example.
* apt(8): Wait for frontend and cache lockJulian Andres Klode2020-02-261-0/+5
| | | | | | This is a rework of !6 with additional stuff for the frontend lock, so we can lock the frontend lock and then keep looping over dpkg lock.
* Make map_pointer<T> typesafeJulian Andres Klode2020-02-241-1/+1
| | | | | | | | | | | Instead of just using uint32_t, which would allow you to assign e.g. a map_pointer<Version> to a map_pointer<Package>, use our own smarter struct that has strict type checking. We allow creating a map_pointer from a nullptr, and we allow comparing map_pointer to nullptr, which also deals with comparisons against 0 which are often used, as 0 will be implictly converted to nullptr.
* Replace map_pointer_t with map_pointer<T>Julian Andres Klode2020-02-242-7/+7
| | | | | | This is a first step to a type safe cache, adding typing information everywhere. Next, we'll replace map_pointer<T> implementation with a type safe one.
* Remove code tagged APT_PKG_590, add some missing includesJulian Andres Klode2020-02-181-0/+1
| | | | | | Remove all code scheduled to be removed after 5.90, and fix files to include files they previously got from hashes.h including more headers.
* Implement short patterns (patterns starting with ~)Julian Andres Klode2020-02-031-2/+2
| | | | | | Also make pattern detector in cacheset and private's list accept such patterns. We probably should just try to parse and see if it is a (start of a) pattern.
* apt(8): Disable regular expressions and fnmatchJulian Andres Klode2020-01-151-0/+1
| | | | | This is the first step. Next step will be to add warnings to apt-get and then remove support there as well.
* Convert users of {MD5,SHA1,SHA256,SHA512}Summation to use HashesJulian Andres Klode2020-01-141-2/+3
| | | | | | | This makes use of the a function GetHashString() that returns the specific hash string. We also need to implement another overload of Add() for signed chars with sizes, so the existing users do not require reinterpret_cast everywhere.
* satisfy: Fix segmentation fault when called with empty argumentJulian Andres Klode2019-12-061-1/+1
| | | | | | | | | apt satisfy "" caused a segmentation fault because we were iterating over the characters, checking if the next character was the end of the string; when it could also be the current character. Instead, check whether the next character is before the end of the string, rather than identical to the end.
* Search in all available description translationsАлексей Шилин2019-11-251-26/+95
| | | | | | | | | | | | When multiple translations of package descriptions are available, perform search in all of them. It allows using search patterns in any of the configured languages. Previously, only the first available translation was searched. As the result, patterns in e.g. English never matched packages which had their descriptions translated into local language. Closes: #490000
* Parse 'show' arguments for the 'info' alias as wellJulian Andres Klode2019-09-271-2/+2
| | | | | | | We recently made info an alias for show, but we did not change the command-line parser to work around it. LP: #1843812
* Add pattern tree parser infra and connect with cacheset and apt listJulian Andres Klode2019-08-151-7/+16
| | | | | This adds a transformation from parse tree into a CacheFilter and connects it with cachesets and the apt list command.
* Apply various suggestions by cppcheckDavid Kalnischkies2019-07-086-15/+15
| | | | Reported-By: cppcheck
* Remove deprecated cacheset methodsJulian Andres Klode2019-06-142-12/+69
| | | | | This mostly turns them private and then overrides the public version with the switch, as recommended.
* Adjust code for missing includes/using std::stringJulian Andres Klode2019-06-121-1/+3
|
* Merge branch 'depend-solutions' into 'master'Julian Andres Klode2019-06-111-16/+16
|\ | | | | | | | | apt-cache: only show solutions if displayed See merge request apt-team/apt!65
| * apt-cache: only show solutions if displayedStephen Kitt2019-05-131-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, apt-cache [r]depends always shows all solutions for a package, if appropriate, even if the package itself wasn’t displayed (e.g. “--installed” was specified). Thus, currently, with haskell-platform uninstalled and amd64 and i386 enabled, “apt-cache rdepends alex” shows alex Reverse Depends: haskell-platform alex:i386 haskell-platform alex:i386 and “apt-cache rdepends alex --installed” shows alex Reverse Depends: alex:i386 alex:i386 which is rather confusing. This patch changes the behaviour so that solutions are only displayed for packages which were themselves displayed; “apt-cache rdepends alex --installed” then shows alex Reverse Depends: Signed-off-by: Stephen Kitt <skitt@debian.org>
* | Introduce apt satisfy and apt-get satisfyJulian Andres Klode2019-06-112-7/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to satisfy dependency strings supplied on the command line, optionally prefixed with "Conflicts:" to satisfy them like Conflicts. Build profiles and architecture restriction lists, as used in build dependencies, are supported as well. Compared to build-dep, build-essential is not installed automatically, and installing of recommended packages follows the global default, which defaults to yes. Closes: #275379 See merge request apt-team/apt!63
* | apt-mark: Add hidden showheld alias for showholdJulian Andres Klode2019-05-101-1/+1
|/ | | | For Unit193 and those who value grammar, I suppose.