summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.h
Commit message (Collapse)AuthorAgeFilesLines
* Delay removals due to Conflicts until Depends are resolvedDavid Kalnischkies2020-07-021-3/+0
| | | | | | | | | | | | | | | | | Marking a package for removal is fine if we know that we have to remove that package, but if we are in an alternative branch we might not go this route in the end and hence have a package pointlessly marked for removal which isn't questioned later on. We check if we are allowed to remove that package to avoid working on the positive dependencies if not, but we mark them for removal only after all the other dependencies are successfully resolved. In an ideal world we would let the problemResolver do its job on them, but the resolver might decide against doing the removal exploring another option like the next alternative, which might be a good idea, but is not the behaviour we had before, so that is the best we can do for now without changing the resolver drastically.
* Allow pkgDepCache to be asked to check internal consistencyDavid Kalnischkies2020-05-241-0/+4
| | | | | | | | For speed reasons pkgDepCache initializes its state once and then has a battery of update calls you have to invoke in the right order to update the various states – all in the name of speed. In debug and/or simulation mode we can sacrifice this speed for a bit of extra checking though to verify that we haven't made some critical mistake like #961266.
* Reset candidate version explicitly for internal state-keepingDavid Kalnischkies2020-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | For a (partially) installed package like the one MarkInstall operates on at the moment we want to discard the candidate from, we have to first remove the package from the internal state keeping to have proper broken counts and such and only then reset the candidate version which is a trivial operation in comparison. Take a look at the testcase: Now, what is the problem? Correct, git:i386. Didn't see that coming, right? It is M-A:foreign so apt tries to switch the architecture of git here (which is pointless, it knows that this won't work, but lets fix that in another commit) will eventually realize that it can't install it and wants to discard the candidate of git:i386 first removing the broken indication like it should, removing the install flag and then reapplies the broken indication: Expect it doesn't as it wants to do that over the candidate version which the package no longer had so seemingly nothing is broken. It is a bit of a hairball to figure out which commit it is exactly that is wrong here as they are all influencing each other a bit, but >= 2.1 is an acceptable ballpark. Bisect says 57df273 but that is mostly a lie. Closes: #961266
* Move the MarkInstall helpers into static functionsDavid Kalnischkies2020-05-181-4/+2
| | | | | | | | Reducing the scope of these helpers might allow us to move them elsewhere and share them or it is a rather pointless exercise, we will see where it leads us to later on. Gbp-Dch: Ignore
* Keep going if a dep is bad for user requests to improve errorsDavid Kalnischkies2020-05-181-2/+2
| | | | | | | | | | | | | | We exit early from installing dependencies of a package only if it is not a user request to avoid polluting the state with installs which might not be needed (or detrimental even) for alternative choices. We do continue with installing dependencies though if it is a user request as it will improve error reporting for apt and can even help aptitude not hang itself so much as we trim the problem space down for its resolver dealing with all the easy things. Similar things can be said about the testcase I have short-circuit previously… keep going test, do what you should do to report errors!
* Allow aptitude to MarkInstall broken packages via FromUserDavid Kalnischkies2020-05-081-1/+1
| | | | | | | | | | | | | | | | | | apt marks packages coming from the commandline among others as protected to ensure the various resolver parts do not fiddle with the state of these packages. aptitude (and potentially others) do not so the state is modified (to a Keep which for uninstalled means it is not going to be installed) due to being uninstallable before the call fails – basically reverting at least some state changes the call made before it realized it has to fail, which is usually a good idea, except if users expect you to not do it. They do set the FromUser option though which has beside controlling autobit also gained the notion of "the user is always right" over time and can be used for this one here as well preventing the state revert. References: 0de399391372450d0162b5a09bfca554b2d27c3d Reported-By: Jessica Clarke <jrtc27@debian.org> on IRC
* Protect a package while resolving in MarkInstallDavid Kalnischkies2020-04-271-2/+2
| | | | | | | | Strange things happen if while resolving the dependencies of a package said dependencies want to remove the package. The allow-scores test e.g. removed the preferred alternative in favor of the last one now that they were exclusive. In our or-group for Recommends we would "just" not statisfy the Recommends and for Depends we engage the ProblemResolver…
* Propagate Protected flag to single-option dependenciesDavid Kalnischkies2020-04-271-1/+1
| | | | | | | | | | | | | | | If a package is protected and has a dependency satisfied only by a single package (or conflicts with a package) this package must be part of the solution and so we can help later actions not exploring dead ends by propagating the protected flag to these "pseudo-protected" packages. An (obscure) bug this can help prevent (to some extend) is shown in test-apt-never-markauto-sections by not causing irreversible autobit transfers. As a sideeffect it seems also to help our crude ShowBroken to display slightly more helpful messages involving the packages which are actually in conflict.
* Fail earlier on impossible Conflicts in MarkInstallDavid Kalnischkies2020-04-271-1/+1
| | | | | | | | MarkDelete is not recursive as MarkInstall is and we can not conflict with ourselves anyhow, so we can move the unavoidable deletes before changing the state of the package in question avoiding the need for the state update in case of conflicts we can not deal with (e.g. the package conflicts with an explicit user request).
* Split up MarkInstall into private helper methodsDavid Kalnischkies2020-04-271-0/+12
| | | | | Should be easier to move the code bits around then and it helps in documenting a bit what the blocks do and how they interact (or not).
* apt-pkg: default visibility to hiddenJulian Andres Klode2020-02-261-6/+6
|
* Run unifdef -DAPT_{8,9,10,15}_CLEANER_HEADERSJulian Andres Klode2019-06-121-8/+0
|
* Make APT::StringView publicJulian Andres Klode2019-06-111-3/+3
|
* depcache: Remove deprecated functionsJulian Andres Klode2019-02-261-4/+0
|
* Increase debug verbosity in `apt-get autoremove`Filipe Brandenburger2018-05-211-1/+5
| | | | | | | | | | | When running with Debug::pkgAutoRemove=yes, explain why certain packages are being marked, either because they're marked essential/important or because they match the blacklist from APT::NeverAutoRemove. This should help troubleshoot cases where autoremove is not proposing removal of packages expected to be up for removal. Tested manually with `apt-get autoremove -o Debug::pkgAutoRemove=yes`.
* Fix various typos reported by spellcheckersDavid Kalnischkies2018-05-051-2/+2
| | | | | Reported-By: codespell & spellintian Gbp-Dch: Ignore
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-3/+3
| | | | | | | | | | | | | This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
* Drop cacheiterators.h includeJulian Andres Klode2017-07-121-1/+0
| | | | | Including cacheiterators.h before pkgcache.h fails because pkgcache.h depends on cacheiterators.h.
* fix various typos reported by spellintianDavid Kalnischkies2017-01-191-1/+1
| | | | | | | | Most of them in (old) code comments. The two instances of user visible string changes the po files of the manpages are fixed up as well. Gbp-Dch: Ignore Reported-By: spellintian
* factor out Pkg/DepIterator prettyprinters into own headerDavid Kalnischkies2016-04-281-0/+1
| | | | | | | | | The old prettyprinters have only access to the struct they pretty print, which isn't enough usually as we want to know for a package also a bit of state information like which version is the candidate. We therefore need to pull the DepCache into context and hence use a temporary struct which is printed instead of the iterator itself.
* do not strip epochs from state version stringsDavid Kalnischkies2016-03-161-2/+2
| | | | | | | | | | | The epoch stripping in this code is done since day one, but in other places we show a version epochs are not stripped. If epochs are present in packages they tend to be an important information which we can't just drop and especially can't drop "sometimes" as that confuses users and tools alike – so even if removing code in use for (close to) 18 years feels wrong, it is probably the right choice for consistency. Closes: 818162
* tests: fix typos, correct helpmsgs and test testsDavid Kalnischkies2015-11-291-1/+1
| | | | Git-Dch: Ignore
* add messages to our deprecation warnings in libaptDavid Kalnischkies2015-11-271-1/+1
| | | | Git-Dch: Ignore
* fix a few typos in code-comments/apt manpageDavid Kalnischkies2015-11-201-1/+1
| | | | | Reported-By: codespell Git-Dch: Ignore
* sanify API to get 'the' candidate versionDavid Kalnischkies2015-11-041-2/+13
| | | | | | | | | This was discussed a while ago on #debian-apt and now that I see myself making this mistake lets bite the bullet and fix it in the easy way out version: Using a new name which fits with a similar named setter and deprecate the old method instead of 'hostily' changing API. Closes: #803471
* Add GetPriority(VerIterator) to pkgDepCache::PolicyJulian Andres Klode2015-08-151-0/+1
| | | | | | | Also unify the case of considerFiles and ConsiderFiles to be ConsiderFiles in all cases. Gbp-Dch: ignore
* Only make Upgradable() return true for packages with a candidateJulian Andres Klode2015-08-121-1/+1
| | | | | | | If there is no candidate, the package should not be considered upgradeable. LP: #896689
* bunch of micro-optimizations for depcacheDavid Kalnischkies2015-08-101-14/+14
| | | | | | | | DepCache functions are called a lot, so if we can squeeze some drops out of them for free we should do so. Takes also the opportunity to remove some whitespace errors from these functions. Git-Dch: Ignore
* add c++11 override marker to overridden methodsDavid Kalnischkies2015-08-101-1/+1
| | | | | | | | | C++11 adds the 'override' specifier to mark that a method is overriding a base class method and error out if not. We hide it in the APT_OVERRIDE macro to ensure that we keep compiling in pre-c++11 standards. Reported-By: clang-modernize -add-override -override-macros Git-Dch: Ignore
* make all d-pointer * const pointersDavid Kalnischkies2015-08-101-2/+2
| | | | | | | | | | | | | | Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore
* apply various style suggestions by cppcheckDavid Kalnischkies2015-08-101-1/+1
| | | | | | | Some of them modify the ABI, but given that we prepare a big one already, these few hardly count for much. Git-Dch: Ignore
* add d-pointer, virtual destructors and de-inline de/constructorsDavid Kalnischkies2015-06-161-2/+4
| | | | | | | | To have a chance to keep the ABI for a while we need all three to team up. One of them missing and we might loose, so ensuring that they are available is a very tedious but needed task once in a while. Git-Dch: Ignore
* explicit overload methods instead of adding parametersDavid Kalnischkies2014-11-081-2/+2
| | | | | | | | Adding a new parameter (with a default) is an ABI break, but you can overload a method, which is "just" an API break for everyone doing references to this method (aka: nobody). Git-Dch: Ignore
* implement MarkAndSweep in cc instead of headerDavid Kalnischkies2014-10-031-13/+2
| | | | | | | | Having it in the header exposes some implementation details, namely private methods and will cause problems for us if we ever want to change the actions. Git-Dch: Ignore
* mark private methods as hiddenDavid Kalnischkies2014-09-301-5/+5
| | | | | | | | | | We are the only possible users of private methods, so we are also the only users who can potentially export them via using them in inline methods. The point is: We don't need these symbols exported if we don't do this, so marking them as hidden removes some methods from the API without breaking anything as nobody could have used them. Git-Dch: Ignore
* discard candidates via IsInstallOk to allow overrideDavid Kalnischkies2014-03-231-0/+2
| | | | | | | | | | | | | | | | | | | In commit 446551c8 I changed MarkInstall to discard the candidate if the candidate can't satisfy the dependency. This breaks interactive solvers like aptitude which can change the candidate on-the-fly later. In commit df77d8a5 I introduced this 'early' loop-breaking to begin with which can't be that helpful for interactive solvers as well, but makes perfect sense for non-interactives to stop them from exploring trees which can't be satisfied, but it isn't perfect as ideally we would check this before auto-installing the first dependency. This commit therefore moves the loop into its own IsInstallOk hook so that frontends can override this check if they want to and in exchange removes the loop-breaking from MarkInstall itself and does it before any dependency is installed. Closes: 740750
* follow method attribute suggestions by gccDavid Kalnischkies2014-03-131-1/+2
| | | | | Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn}
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-2/+10
| | | | | | | | Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
* warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies2014-03-131-1/+1
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* make doxygen more quiet, fix issues and disable latexDavid Kalnischkies2014-03-131-3/+3
| | | | Git-Dch: Ignore
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-1/+1
|
* don't consider holds for autoremovalDavid Kalnischkies2013-10-011-1/+1
| | | | | | | | | | | We can't remove packages which are held back by the user with a hold, so marking them (or its dependencies) as garbage will lead our autoremover into madness – and given that the package is important enough that the user has held it back it can't be garbage (at least at the moment), so even if a front-end wants to use the info just for information display its a good idea to not consider it garbage for them. Closes: 724995
* prevent MarkInstall of unsynced Multi-Arch:same siblingsDavid Kalnischkies2013-07-111-13/+17
| | | | | | | | | | | | | | | | | | | Multi-Arch: same packages can be co-installed, but need to have the same version for all installed packages (aka "siblings"). Otherwise the unsynced versions will fight against each other and the auto-install as wel as the problem resolver will later have to decide between holding the packages or to remove one of the siblings (usually a foreign) taking a bunch of packages (like the entire foreign setup) with them. The idea here is now to be more pro-active: MarkInstall will fail for a package if the siblings aren't synced, so we don't allow a situation in which a resolver has to decide if to hold or to remove-upgrade under the assumption that the remove-upgrade decision is always wrong and doesn't deserve to be explored (expect valid out-of-syncs of course). Thats a pretty bold move to take for a library which is used by different solvers so this check is done in IsInstallOk and can be overridden if front-ends want to.
* revert 2184.1.3: forward declaration instead of headersDavid Kalnischkies2011-12-131-0/+5
| | | | | The breakage is just to big for now, so guard the change with #ifndef APT_8_CLEANER_HEADERS and be nice to library users
* use forward declaration in headers if possible instead of includesDavid Kalnischkies2011-09-191-2/+3
|
* do not pollute namespace in the headers with using (Closes: #500198)David Kalnischkies2011-09-191-3/+3
|
* merged from the debian-sid branchMichael Vogt2011-08-151-2/+2
|\
| * rename the parameter name of MarkDelete from Purge to MarkPurge toDavid Kalnischkies2011-08-111-2/+2
| | | | | | | | | | | | fix a cosmetic warning from cppcheck: [apt-pkg/depcache.h:462] -> [apt-pkg/depcache.h:122]: (style) Variable 'Purge' hides enumerator with same name
* | [ABI break] merge patch from Jonathan Thomas to speed up theMichael Vogt2011-07-281-1/+9
| | | | | | | | depcache by caching the install-recommends and install-suggests values
* | merge lp:~mvo/apt/abi-breakMichael Vogt2011-06-291-17/+11
|\ \ | |/ |/|