summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheset.cc
Commit message (Collapse)AuthorAgeFilesLines
* Implement short patterns (patterns starting with ~)Julian Andres Klode2020-02-031-1/+1
| | | | | | 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-2/+12
| | | | | This is the first step. Next step will be to add warnings to apt-get and then remove support there as well.
* Add pattern tree parser infra and connect with cacheset and apt listJulian Andres Klode2019-08-151-1/+30
| | | | | This adds a transformation from parse tree into a CacheFilter and connects it with cachesets and the apt list command.
* Remove deprecated cacheset methodsJulian Andres Klode2019-06-141-10/+0
| | | | | This mostly turns them private and then overrides the public version with the switch, as recommended.
* cacheset: Remove simple cases of deprecated codeJulian Andres Klode2019-05-061-27/+0
| | | | | | This is missing the ones that are still actively used in cacheset.cc, we need to clean those up too, but they are obviously more tricky.
* remove pointless APT_PURE from void functionsDavid Kalnischkies2017-12-141-5/+5
| | | | | | | | | | | Earlier gcc versions used to complain that you should add them althrough there isn't a lot of point to it if you think about it, but now gcc (>= 8) complains about the attribute being present. warning: ‘pure’ attribute on function returning ‘void’ [-Wattributes] Reported-By: gcc -Wattributes Gbp-Dch: Ignore
* Replace APT_CONST with APT_PURE everywhereJulian Andres Klode2017-08-241-5/+5
| | | | | As a follow up to the last commit, let's replace APT_CONST with APT_PURE everywhere to clean stuff up.
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-9/+9
| | | | | | | | | | | | | 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-2/+2
| | | | | | | | 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
* support regex and co in 'apt-cache policy $pkg' againDavid Kalnischkies2015-12-141-1/+1
| | | | | | | | | | Regression of 1e064088bf7b3e29cd36d30760fb3e4143a1a49a (1.1~exp4) which moved code around and renamed methods heavily ending up calling the wrong method matching packagenames only instead of calling the full array. Most commands work with versions, so this managed to fly under the radar for quite a while. Closes: 807870
* support .deb files in upgrade operations as wellDavid Kalnischkies2015-11-041-8/+2
| | | | | | The main part is refactoring through to allow hiding the magic needed to support .deb files in deeper layers of libapt so that frontends have less exposure to Debian specific classes like debDebPkgFileIndex.
* implement dpkgs vision of interpreting pkg:<arch> dependenciesDavid Kalnischkies2015-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
* use c++11 algorithms to avoid strange compiler warningsDavid Kalnischkies2015-08-291-12/+4
| | | | | | | | | | | | | Nobody knows what makes the 'unable to optimize loop' warning to appear in the sourceslist minus-options parsing, especially if we use a foreach loop, but we can replace it with some nice c++11 algorithm+lambda usage, which also helps in making even clearer what happens here. And as this would be a lonely change, lets do it for a few more loops as well where I might or might not have seen the warning at some point in time, too. Git-Dch: Ignore
* cacheset: Prefer the depcache over the policy againJulian Andres Klode2015-08-271-5/+5
| | | | | | | | | | | | | | By preferring the policy over the depcache, we ignore any changes we made in the depcache, which makes it impossible for code to change the candidate used here. This basically reverts commit 2fbfb111312257fa5fc29b0c2ed386fb712f960e: prefer the Policy if it is built instead of the DepCache and if DepCache is not available as fallback built the Policy But it also cleans the code up a bit, by removing one level of nesting.
* avoid virtual in the iteratorsDavid Kalnischkies2015-08-101-1/+2
| | | | | | | | With a bit of trickery and the Curiously recurring template pattern we can free us from our use of virtual in the iterators were it is unneeded bloat as we never deal with pointers to iterators and similar such. Git-Dch: Ignore
* show or-groups in not-installed recommends and suggests listsDavid Kalnischkies2015-08-101-0/+110
| | | | | | | | 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-5/+14
| | | | | | | | | | | | | | 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
* add d-pointer, virtual destructors and de-inline de/constructorsDavid Kalnischkies2015-06-161-1/+14
| | | | | | | | 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
* fix some new compiler warnings reported by gcc-5David Kalnischkies2015-03-161-2/+2
| | | | Git-Dch: Ignore
* replace ignore-deprecated #pragma dance with _PragmaDavid Kalnischkies2014-11-081-36/+10
| | | | | | | | | For compatibility we use/provide and fill quiet some deprecated methods and fields, which subsequently earns us a warning for using them. These warnings therefore have to be disabled for these codeparts and that is what this change does now in a slightly more elegant way. Git-Dch: Ignore
* move PCI::From* methods into CacheSetHelper classDavid Kalnischkies2014-09-271-56/+68
| | | | | | | | | | | | | | The methods itself deal with the helper a lot, so it makes sense to move them to the helper itself, which helps also if we want to override some of these methods, the FromString mentioned in the bugreport being the obvious example. VCI is spared from this change for now as while it would fit with the same reasoning it much heavier entangled with the previous CacheSetHelper change, so moving it now would mean breaking the API. The PCI change is worthwhile on its own though as it is used by VCI. Closes: 686221
* rework cachesets API to allow future extensionDavid Kalnischkies2014-09-271-68/+196
| | | | | | | | | | | | | | | The introduction of Fnmatch showed that each new selector would require multiple new virtual methods in the CacheSetHelper to work correctly, which isn't that great. We now flip to a single virtual method which handles all cases separated by an enum – as new enum values can be added without an ABI break. Great care was taken to make old code work with the new way of organisation, which means in return that you might be bombarded with deprecation warnings now if you don't adapt, but code should still compile and work as before as can be seen in apt itself with this commit. Git-Dch: Ignore
* Do not crash for apt-get install /dev/nullMichael Vogt2014-07-161-0/+2
| | | | | | Thanks to Jakub Wilk for the bugreport. Closes: #754904
* Allow passing a full path to apt-get install /foo/bar.debMichael Vogt2014-07-101-1/+8
| | | | CLoses: #752327
* fix some compile errors in the now enabled #if (APT_PKG_MAJOR >= 4 && ↵Michael Vogt2014-05-071-4/+5
| | | | APT_PKG_MINOR < 13)
* handle pkgnames shorter than modifiersDavid Kalnischkies2014-04-261-2/+4
| | | | | | | | | | | The bugreport highlights the problem with an empty package name. We fix this by 'ignoring' these so that it behaves just like "apt-get install". The deeper problem is that modifier strings can be longer than a package name in which case the comparison doesn't make sense, so don't compare then. Was not noticed so far as all modifiers are of length 1, so the only package name shorter than this is in fact the empty package name. Closes: 744940
* follow method attribute suggestions by gccDavid Kalnischkies2014-03-131-5/+5
| | | | | Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn}
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-4/+12
| | | | | | | | 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-14/+14
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* prepare re-enable fnmatch() once we have proper reportingMichael Vogt2014-02-201-0/+3
|
* disable fnmatch()Michael Vogt2014-02-141-1/+0
| | | | | | | | | | | The current PackageContainerInterface::FromString() will do a FromFnmatch() first and then FromRegEx(). This commit reverts that change to restore the old behavior to only look for RegEx and not glob-style pattern. The rational is that: a) currently a fnmatch() is misleadingly reported as a regex match to the user (Bug#738880) b) a fnmatch may match something different than a a RegEx so the change broke a published interface
* add missing canNotFindFnmatch/showFnmatchSelection (for the next ABI break)Michael Vogt2014-02-141-2/+23
|
* rework some code to fix some scan-build warningsDavid Kalnischkies2014-01-161-0/+2
| | | | | | | | No visible functional changes, just code moved around and additional checks to eliminate impossible branches Reported-By: scan-build Git-Dch: Ignore
* squash merge of the feature/apt-binary branch without the changes from ↵Michael Vogt2013-08-121-0/+64
| | | | experimental
* * apt-pkg/cacheset.cc:David Kalnischkies2012-07-181-0/+2
| | | | - handle :all and :native correctly as architectures again in the commandline parsing (regression in 0.9.7)
* * apt-pkg/cacheset.cc:David Kalnischkies2012-06-141-4/+50
| | | | - add PackageContainerInterface::FromGroup to support architecture specifications with wildcards on the commandline
* * apt-pkg/cacheset.cc:David Kalnischkies2012-04-201-2/+5
| | | | - actually return to the fallback modifier if we have detected we should for packagenames which look like modifiers (Closes: #669591)
* * apt-pkg/cacheset.cc:David Kalnischkies2011-11-091-178/+203
| | | | - make the cachesets real containers which can embedding any container to be able to use the same interface regardless of set or list usage
* use forward declaration in headers if possible instead of includesDavid Kalnischkies2011-09-191-2/+5
|
* reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies2011-09-131-2/+4
|
* * merged lp:~evfool/apt/fix641673Michael Vogt2011-02-101-1/+1
| | | | - String-fix in the source and the translations for the grammatical mistake reported in bug LP: #641673, thanks to Robert Roth
* - [ABI BREAK] add an ErrorType option to CacheSetHelperDavid Kalnischkies2010-07-301-9/+9
| | | | | * cmdline/apt-cache.cc: - use Notice instead of Error in the CacheSetHelper messages for compat reasons. Otherwise tools like sbuild blow up
* * apt-pkg/cacheset.cc:Michael Vogt2010-07-301-1/+1
| | | | | - make CacheSetHelper::canNotFindAllVer display a notice only (for compat reasons). Otherwise tools like sbuild blow up
* - add a 'newest' pseudo target release as in pkg/newestDavid Kalnischkies2010-07-261-1/+6
| | | *
* * apt-pkg/cacheset.cc:David Kalnischkies2010-07-171-0/+506
| | | - move them back to the library as they look stable now
* * cmdline/cacheset.cc:David Kalnischkies2010-06-151-330/+0
| | | - doesn't include it in the library for now as it is too volatile
* Add a GroupedFromCommandLine for the VersionSet similar to theDavid Kalnischkies2010-06-151-39/+84
| | | | | one for PackageSet and refactor the existing VersionSet methods to simplify that.
* * apt-pkg/cacheset.cc:David Kalnischkies2010-06-101-3/+8
| | | | - get the candidate either from an already built depcache or use the policy which is a bit faster than depcache generation
* add a GroupedFromCommandLine method to the PackageSet to split theDavid Kalnischkies2010-06-061-0/+33
| | | | packages on the commandline into groups based on modifiers