summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
Commit message (Collapse)AuthorAgeFilesLines
* typo: run s#frontend#front-end# on all of src:aptDavid Kalnischkies2015-11-251-1/+1
| | | | | | The manpages were fixed by Justin B Rye, lets deal with the rest now. Git-Dch: Ignore
* sanify API to get 'the' candidate versionDavid Kalnischkies2015-11-041-1/+6
| | | | | | | | | 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
* Cleanup includes after running iwyuMichael Vogt2015-08-171-1/+0
|
* Add GetPriority(VerIterator) to pkgDepCache::PolicyJulian Andres Klode2015-08-151-0/+2
| | | | | | | Also unify the case of considerFiles and ConsiderFiles to be ConsiderFiles in all cases. Gbp-Dch: ignore
* Deprecate SPtrArray<T> and convert everyone to unique_ptr<T[]>Julian Andres Klode2015-08-131-2/+2
| | | | More standardization
* C++11: Switch from auto_ptr to unique_ptrJulian Andres Klode2015-08-131-1/+1
| | | | This is nicer
* move manual-bit from 'oldlibs' pkg to its dependenciesDavid Kalnischkies2015-08-101-0/+28
| | | | | | | | | | | | | | | | | | | | | oldlibs used to be in APT::Never-MarkAuto-Sections so that old transition packages can be removed without causing the then (autoinstalled) renamed package to be autoremoved. It isn't ideal through as ideally you want the oldlibs package to be removed after nothing depends on it anymore regardless of if you have once installed it by hand or not – and if you had the package talking over (the dependencies) should carry the manual bit now as they are the real deal now. As an added bonus if the package has no dependencies because it is an oldlibs without a direct replacement you should move away from (like lib1 and lib2 are currently in the archive, but there will hopefully only be lib2 in the release) you get a lib1 marked as auto. If the user still needs the oldlibs package for some reason all he has to do is mark it as manual once as this move is only performed if a installed package changes its section from a not-Move-Autobit-Sections to a Move-Autobit-Sections.
* move APT::Never-MarkAuto-Sections handling to MarkDeleteDavid Kalnischkies2015-08-101-9/+35
| | | | | | | | | | | | Having the handling in MarkInstall means that it just effects installation of the metapackage, but if the dependencies change the new dependencies aren't protected (and the old dependencies are still protected for no 'reason'). Having it in MarkDelete means that if a metapackage is sheduled for removal all its currently installed dependencies are marked as manual, which helps against both as in this case there is no new/old and additionally if a user decides the installation of a metapackage was wrong he can just remove it explicitely avoid the manual marking entirely.
* mark again deps of pkgs in APT::Never-MarkAuto-Sections as manualDavid Kalnischkies2015-08-101-2/+7
| | | | | | | | | | | | | | | | | | In 50ef3344c3afaaf9943142906b2f976a0337d264 (and similar for other branches), while 'fixing' the edgecase of a package being in multiple sections (e.g. moved from libs to oldlibs in newer releases) I accidently broke the feature itself completely by operating on the package itself and no longer on its dependencies… The behaviour isn't ideal in multiple ways, which we are hopefully able to fix with new ideas as mentioned in the buglog, but until then the functionality of this "hack" should be restored. Reported-By: Raphaël Hertzog <hertzog@debian.org> Tested-By: Adam Conrad <adconrad@ubuntu.com> Closes: 793360 LP: 1479207 Thanks: Raphaël Hertzog and Adam Conrad for detailed reports and initial patches
* split-up Dependency structDavid Kalnischkies2015-08-101-6/+5
| | | | | | | | | | | | | | | | | | | | | Having dependency data separated from the link between version/package and the dependency allows use to work on sharing the depdency data a bit as it turns out that many dependencies are in fact duplicates. How many are duplicates various heavily with the sources configured, but for a single Debian release the ballpark is 2 duplicates for each dependency already (e.g. libc6 counts 18410 dependencies, but only 45 unique). Add more releases and the duplicates count only rises to get ~6 for 3 releases. For each architecture a user has configured which given the shear number of dependencies amounts to MBs of duplication. We can cut down on this number, but pay a heavy price for it: In my many releases(3) + architectures(3) test we have a 10% (~ 0.5 sec) increase in cache creationtime, but also 10% less cachesize (~ 10 MB). Further work is needed to rip the whole benefits from this through, so this is just the start. Git-Dch: Ignore
* bunch of micro-optimizations for depcacheDavid Kalnischkies2015-08-101-88/+82
| | | | | | | | 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
* show or-groups in not-installed recommends and suggests listsDavid Kalnischkies2015-08-101-12/+3
| | | | | | | | Further abstracting our new ShowList allows to use it for containers of strings as well giving us the option to implement an or-groups display for the recommends and suggests lists which is a nice trick given that it also helps with migrating the last remaining other cases of old ShowList.
* 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-2/+4
| | | | | | | Some of them modify the ABI, but given that we prepare a big one already, these few hardly count for much. Git-Dch: Ignore
* store Release files data in the CacheDavid Kalnischkies2015-06-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | We used to read the Release file for each Packages file and store the data in the PackageFile struct even through potentially many Packages (and Translation-*) files could use the same data. The point of the exercise isn't the duplicated data through. Having the Release files as first-class citizens in the Cache allows us to properly track their state as well as allows us to use the information also for files which aren't in the cache, but where we know to which Release file they belong (Sources are an example for this). This modifies the pkgCache structs, especially the PackagesFile struct which depending on how libapt users access the data in these structs can mean huge breakage or no visible change. As a single data point: aptitude seems to be fine with this. Even if there is breakage it is trivial to fix in a backportable way while avoiding breakage for everyone would be a huge pain for us. Note that not all PackageFile structs have a corresponding ReleaseFile. In particular the dpkg/status file as well as *.deb files have not. As these have only a Archive property need, the Component property takes over this duty and the ReleaseFile remains zero. This is also the reason why it isn't needed nor particularily recommended to change from PackagesFile to ReleaseFile blindly. Sticking with the earlier is usually the better option.
* rewrite all TFRewrite instances to use the new pkgTagSection::WriteDavid Kalnischkies2015-05-111-30/+20
| | | | | | | | | While it is mostly busywork to rewrite all instances it actually fixes bugs as the data storage used by the new method is std::string rather than a char*, the later mostly created by c_str() from a std::string which the caller has to ensure keeps in scope – something apt-ftparchive actually didn't ensure and relied on copy-on-write behavior instead which c++11 forbids and hence the new default gcc abi doesn't use it.
* show non-matching m-a:same versions in debug messageDavid Kalnischkies2015-05-111-6/+11
| | | | | Slightly rewriting the code to ensure we only use two sources for the versions as it could otherwise be confusing to look at.
* create directory for extended_states if neededDavid Kalnischkies2014-11-181-1/+3
| | | | | Unlikely perhaps, but there is no guarantee that the directory we want to drop the file into actually exists, so create it if we must.
* implement MarkAndSweep in cc instead of headerDavid Kalnischkies2014-10-031-0/+14
| | | | | | | | 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
* Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-051-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc configure.ac debian/changelog doc/apt-verbatim.ent doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pt.po po/ar.po po/ast.po po/bg.po po/bs.po po/ca.po po/cs.po po/cy.po po/da.po po/de.po po/dz.po po/el.po po/es.po po/eu.po po/fi.po po/fr.po po/gl.po po/hu.po po/it.po po/ja.po po/km.po po/ko.po po/ku.po po/lt.po po/mr.po po/nb.po po/ne.po po/nl.po po/nn.po po/pl.po po/pt.po po/pt_BR.po po/ro.po po/ru.po po/sk.po po/sl.po po/sv.po po/th.po po/tl.po po/tr.po po/uk.po po/vi.po po/zh_CN.po po/zh_TW.po test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
| * initialize iPolicyBrokenCount in DepCache::UpdateWarren He2014-08-291-1/+2
| | | | | | | | | | | | | | | | All other counters are correctly initialized here, expect this one. The practical effect is low as in apt we usually just do "!= 0" checks, but only correct counters are good counters. Closes: 758397
* | remove the Section member from package structDavid Kalnischkies2014-06-181-1/+1
|/ | | | | | | | | | | | | | | | | | A version belongs to a section and has hence a section member of its own. A package on the other hand can have multiple versions from different sections. This was "solved" by using the section which was parsed first as order of sources.list defines, but that is obviously a horribly unpredictable thing. We therefore directly remove this struct member to free some space and mark the access method as deprecated, which is told to return the section of the 'newest' known version, which is at least predictable, but possible not what it returned before – but nobody knows. Users are way better of with the Section() as returned by the version they are dealing with. It is likely the same for all versions of a package, but in the few cases it isn't, it is important (like packages moving from main/* to contrib/* or into oldlibs …).
* do not revert candidate for protected packagesDavid Kalnischkies2014-06-071-1/+1
| | | | | | | | | | | In commit 21b3eac8 I promoted the check for installable dependencies to a pre-install check, which also reverts to a known good candidate (the installed version) if it fails. This revert was done even for user requested candidate switches which disabled our Broken detection so that install requests which are impossible to satisfy do not fail anymore, but print an (incomplete) solution proposal and then exit successfully. Closes: 745046
* Do not try to cast a pkgDepCache::Policy to a pkgCacheMichael Vogt2014-05-271-1/+1
| | | | | | Fix incorrect cast in pkgDepCache::Policy::GetCandidateVer() Reported-By: clang -fsanitize=address -fno-omit-frame-pointer
* discard candidates via IsInstallOk to allow overrideDavid Kalnischkies2014-03-231-20/+58
| | | | | | | | | | | | | | | | | | | 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
* do IsInstallOk call in MarkInstall unconditionallyDavid Kalnischkies2014-03-231-4/+8
| | | | | | | | Hooked checks could be influenced by AutoInst as a lot can happen between a call without and one with this bit set. The real cache-hit check is above this call already. Individual hooked checks can then inspect the state if they want to cache. Calling them multiple times shouldn't be a problem either way.
* follow method attribute suggestions by gccDavid Kalnischkies2014-03-131-2/+2
| | | | | Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn}
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-4/+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-5/+5
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* warning: no previous declaration for foobar() [-Wmissing-declarations]David Kalnischkies2014-03-131-1/+1
| | | | | Git-Dch: Ignore Reported-By: gcc -Wmissing-declarations
* warning: extra ‘;’ [-Wpedantic]David Kalnischkies2014-03-131-2/+2
| | | | | Git-Dch: Ignore Reported-By: gcc -Wpedantic
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-3/+3
|
* Merge remote-tracking branch 'mvo/bugfix/multiarch-upgrade' into debian/sidMichael Vogt2014-02-061-0/+5
|\
| * Fix multiarch package upgrade issueMichael Vogt2014-02-041-0/+5
| | | | | | | | | | | | When checking for negative dependencies in MarkInstall() ensure that only dependencies that are relevant (i.e. getting installed) are checked.
* | discard impossible candidates in MarkInstallDavid Kalnischkies2014-02-061-2/+7
|/ | | | | | | | | If a (Pre-)Depends can't be satisfied there is no point in keeping the candidate as is as it is impossible to find a solution for it, so we can just as well reset the candidate to the currently installed version. We avoid trying to install this impossible candidate later on this way. Closes: #735967
* fix crash when SetCandidateRelease is usedMichael Vogt2013-11-291-1/+1
|
* don't consider holds for autoremovalDavid Kalnischkies2013-10-011-3/+4
| | | | | | | | | | | 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
* prefer native arch over higher priority for providersColin Watson2013-08-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | The rational from the buglog: > The problem here is that the Priority field in one of the Packages files > is incorrect due to a mishap with reprepro configuration, […] the > amd64 version is Priority: standard but the arm64 version is Priority: > optional (and has a stray "optional: interpreters" field). > […] > However, Priority is a rather weak property of a package because it's > typically applied via overrides, and it's easy for maintainers of > third-party repositories to misconfigure them so that overrides aren't > applied correctly. It shouldn't be ranked ahead of choosing packages > from the native architecture. In this case, I have no user-mode > emulation for arm64 set up, so choosing m4:arm64 simply won't work. This effectly makes the priority the least interesting data point in chosing a provider, which is in line with the other checks we have already order above priority in the past and also has a certain appeal by the soft irony it provides. Closes: #718482
* prevent MarkInstall of unsynced Multi-Arch:same siblingsDavid Kalnischkies2013-07-111-4/+49
| | | | | | | | | | | | | | | | | | | 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.
* Merge remote-tracking branch 'donkult/debian/sid' into debian/sidMichael Vogt2013-07-021-6/+14
|\ | | | | | | | | Conflicts: debian/changelog
| * try all providers in order if uninstallable in MarkInstallDavid Kalnischkies2013-06-091-5/+13
| |
| * fix priority sorting by prefering higher in MarkInstallDavid Kalnischkies2013-06-091-1/+1
| | | | | | | | | | | | | | Used to work until a certain (here unnamed) person came along and used the wrong operator causing low-priority packages to be sorted above high-priority packages while choosing a provider in commit 2b5c35c7bb915dbd46fefd7c79f05364ba22f93b from Nov 2011
* | when doing MarkInstall() packages may also get removed, so show them in the ↵Michael Vogt2013-06-271-3/+10
|/ | | | debug output of Debug::pkgDepCache::AutoInstall=true
* * apt-pkg/cacheiterators.h:David Kalnischkies2013-04-031-15/+10
| | | - provide DepIterator::IsSatisfied as a nicer shorthand for DepCheck
* * apt-pkg/depcache.cc:David Kalnischkies2013-02-241-0/+31
| | | | - prefer to install packages which have an already installed M-A:same sibling while choosing providers (LP: #1130419)
* no mode changes should obviously be ok for pkgDepCache::IsModeChangeOkDavid Kalnischkies2012-11-091-2/+6
|
* * apt-pkg/depcache.cc:David Kalnischkies2012-11-091-13/+6
| | | | - don't call MarkInstall with the FromUser flag set for packages which are dependencies of APT::Never-MarkAuto-Sections matchers
* * apt-pkg/pkgcache.cc:David Kalnischkies2012-09-191-1/+1
| | | | - ignore negative dependencies applying in the same group for M-A:same packages on the real package name as self-conflicts
* provider is only a possible solution if the provides has the rightDavid Kalnischkies2012-04-231-1/+1
| | | | version (or none as we have no versioned provides in debian) and not if the version of the provider matches
* * apt-pkg/depcache.cc:David Kalnischkies2012-04-231-12/+13
| | | | | - clearly separate 'positive' and 'negative' dependencies and their upgrade-resolution tries in MarkInstall and especially don't treat Conflicts differently compared to Breaks here