summaryrefslogtreecommitdiff
path: root/apt-private
Commit message (Collapse)AuthorAgeFilesLines
* 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
* private-json-hooks.cc: deal with EPIPEMichael Vogt2019-01-291-1/+1
| | | | | | | | | | | While running our CI we noticed that sometimes we see an error from the new json hooks code. The error message is: ``` E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Broken pipe ``` when purging the snapd package which provides the hook. This indicates that we should probably also consider EPIPE not an error (just like we do for ECONNRESET). This PR does exactly this.
* Add a "reinstall" command as an alias for "install --reinstall".Josh Triplett2019-01-272-4/+6
| | | | aptitude has a similar "reinstall" command for precedent.
* apt-mark: Introduce minimize-manualJulian Andres Klode2019-01-101-2/+9
| | | | | | | This visits dependencies of all manually installed metapackages, as determined by APT::Never-MarkAuto-Sections, and marks them as automatically installed. It can be used to clean up autoflags after a d-i install, for example.
* apt-private: Export some functions for apt-markJulian Andres Klode2019-01-071-2/+2
| | | | | | | We need to show a yes/no prompt in minimize-manual, and pretty package names, so export them here. Gbp-Dch: ignore
* Provide a "autopurge" shortcutJulian Andres Klode2018-12-032-2/+8
| | | | | | | This adds a new "autopurge" command that will is a shortcut for "autoremove --purge" Thanks: Michael Vogt for the initial work
* Fix typo reported by codespell in code commentsDavid Kalnischkies2018-11-251-1/+1
| | | | | | | | No user visible change expect for some years old changelog entries, so we don't really need to add a new one for this… Reported-By: codespell Gbp-Dch: Ignore
* Print useful error on "apt changelog" without argumentsJulian Andres Klode2018-11-211-1/+1
| | | | Fixes Debian/apt#77
* Deal with descriptions embedded in displayed record correctlyDavid Kalnischkies2018-09-201-11/+58
| | | | | | | | | | | | | | | The implementation of "apt-cache show" (not "apt show") incorrectly resets the currently used parser if the record itself and the description to show come from the same file (as it is the case if no Translation-* files are available e.g. after debootstrap). The code is more complex than you would hope to support some rather unusual setups involving Descriptions and their translations as tested for by ./test-bug-712435-missing-descriptions as otherwise this could be a one-line change. Regression-Of: bf53f39c9a0221b670ffff74053ed36fc502d5a0 Closes: #909155
* Show all architectures in 'apt list' outputDavid Kalnischkies2018-09-152-6/+11
| | | | | | | | | The uniqueness in std::set containers is ensured by the ordering operator we provide, but it was not considering that different versions can have the same description like the different architectures for a version of a package. Closes: #908218
* Merge branch 'bugfix/big-lock' into 'master'Julian Andres Klode2018-08-071-2/+2
|\ | | | | | | | | Add support for dpkg frontend lock See merge request apt-team/apt!11
| * Add support for dpkg frontend lockJulian Andres Klode2018-08-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dpkg frontend lock is a lock dpkg tries to acquire except if the frontend already acquires it. This fixes a race condition in the install command where the dpkg lock is not held for a short period of time between different dpkg invocations. For this reason we also define an environment variable DPKG_FRONTEND_LOCKED for dpkg invocations so dpkg knows not to try to acquire the frontend lock because it's held by a parent process. We can set DPKG_FRONTEND_LOCKED only if the frontend lock really is held; that is, if our lock count is greater than 0 - otherwise an apt client not using the LockInner family of functions would run dpkg without the frontend lock set, but with DPKG_FRONTEND_LOCKED set. Such a process has a weaker guarantee: Because dpkg would not lock the frontend lock either, the process is prone to the existing races, and, more importantly, so is a new style process. Closes: #869546 [fixups: fix error messages, add public IsLocked() method, and make {Un,}LockInner return an error on !debSystem]
* | Add trailing newline to output of edit-sources.Jean-Ralph Aviles2018-06-301-1/+1
|/ | | | Makes the console output cleaner.
* Handle JSON hooks that just close the file/exit and fix some other errorsJulian Andres Klode2018-06-271-2/+8
| | | | | | | | | | | | | | JSON hooks might disappear and the common idiom to work around hooks disappearing is to check for the hook in the shell snippet that is in the apt.conf file and if it does not exist, do nothing. This caused APT to fail however, expecting it to acknowledge the handshake. Ignoring ECONNRESET on handshakes solves the problem. The error case, and the other error cases also did not stop execution of the hook, causing more errors to pile up. Fix this by directly going to the closing part of the code. LP: #1776218
* Support local files as arguments in show commandDavid Kalnischkies2018-05-113-27/+101
| | | | | | | | | | | | | Now that --with-source is supported in show we can go a little further and add the "syntactic sugar" of supporting deb-files on the commandline directly to give users an alternative to remembering dpkg -I for deb files & as a bonus apt also works on changes files. Most of the code churn is actually to deal with cases probably not too common in reality like mixing packages and deb-files on the commandline and getting the right order for these multiple records. Closes: 883206
* Support --with-source in show & search commandsDavid Kalnischkies2018-05-113-92/+110
|
* Support release selector for volatile files as wellDavid Kalnischkies2018-05-114-50/+120
| | | | | | | | | | The syntax is a bit awkward, but it is the same as for a package name and introducing another syntax wouldn't really help usability, so with apt install ./foo.deb/experimental you will get the dependencies of foo satisfied by your default release, but if this wouldn't satisfy the version requirements the candidate for this dependency is switched to the version from the experimental release. The same applies for apt build-dep ./foo.dsc/stable-backports which was the initial request.
* Extend apt build-dep pkg/release to switch dep as neededDavid Kalnischkies2018-05-112-8/+42
| | | | | | apt install pkg/release follows versioned dependencies in the candidate switching if the current candidate does not satisfy the dependency, so for uniformity the same should be supported in build-dep.
* Introduce experimental new hooks for command-line toolsJulian Andres Klode2018-04-155-7/+475
| | | | | | | | | This allows third-party package managers like snap or flatpak to hook in and suggest alternatives if packages could not be found, for example. This is still highly experimental and the protocol might change in future versions.
* apt-private: Collect not found packages in CacheSetHelperAPTGetJulian Andres Klode2018-04-132-3/+9
| | | | | Collecting the packages we could not find allows us to pass them to other places.