summaryrefslogtreecommitdiff
path: root/apt-private
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add 'explicit' to most single argument constructorsJulian Andres Klode2019-04-303-2/+4
| | | | | | | | | | | This prevents implicit conversions that we do not want, such as having a FileFd* being converted to a debListParser. Two cases are not yet handled because they require changes in code using them: 1. The classes in hashes.h 2. The URI class - this one is used quite a lot
* acq: worker: Move CurrentSize, TotalSize, ResumePoint to CurrentItemJulian Andres Klode2019-04-301-7/+7
| | | | | These status fields belong to the current item, move them there. This prepares us for eventually having multiple current items.
* Merge tag '1.8.0'Julian Andres Klode2019-03-081-1/+1
|\ | | | | | | apt Debian release 1.8.0
| * Fix name of APT::Update::Post-Invoke-Stats (was ...Update-Post...)Julian Andres Klode2019-03-061-1/+1
| | | | | | | | Bad accident. Accidents happen.
* | apt-private: Remove unused InitLocale() variantJulian Andres Klode2019-02-262-2/+0
| |
* | sptr: Remove deprecated smart pointer classesJulian Andres Klode2019-02-261-1/+0
| | | | | | | | Please use the standard C++ variants instead.
* | acquire: Fold pkgAcquireStatus2 into pkgAcquireStatusJulian Andres Klode2019-02-262-4/+4
| | | | | | | | Clean up the code, make it neat, lalala
* | clean: Fold pkgArchiveCleaner2 into pkgArchiveCleanerJulian Andres Klode2019-02-261-1/+1
| |
* | pkgSrcRecords::Parser: Fold Files2() into Files()Julian Andres Klode2019-02-261-3/+3
|/ | | | This is possible now with the API break. Cleaner code, woohoo.
* Introduce APT::Install::Pre-Invoke / Post-Invoke-SuccessJulian Andres Klode2019-02-131-1/+6
| | | | | | | | | These will run in our frontends currently, and can show messages. For the sake of keeping the implementation complexity low, a non-success variant of Post-Invoke is not provided. LP: #1815761
* update: Provide APT::Update-Post-Invoke-Stats script hook pointJulian Andres Klode2019-02-131-0/+2
| | | | | | | | This is run after an update has been run and only if status on the new cache has been shown, allowing scripts to display their own status messages. LP: #1815760