summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheiterators.h
Commit message (Collapse)AuthorAgeFilesLines
* pkgcache: Change inline to constexpr noexceptJulian Andres Klode2026-02-101-134/+134
| | | | | | | | | | | | | | | In particular, map_pointer and iterators are now all literal types, with most functions translated to constexpr noexcept. This allows them to be used in constexpr contexts in C++17; and the compiler to generate better code knowing they cannot throw exceptions. This transformation is safe, because the functions are inline. more constexpr
* Implement architecture variantsJulian Andres Klode2025-10-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Architecture variants are children of an architecture that share the same ABI but are optimized for different ISA levels. They are available in Ubuntu 25.10 and newer, and not supported in Debian or other distributions. A deb built for a variant contains the Architecture-Variant field, and the Architecture field points to the baseline, for example: Architecture: amd64 Architecture-Variant: amd64v3 However, the apt-get indextargets command reports the variant in the Architecture: field, and most of the code in APT presents the variant as the architecture. There are two types of variants: 1. Standalone variants are recorded in the Architectures field of the Release file as if they were a real architecture: Architectures: amd64 amd64v3 Standalone architecture variants only fetch the standalone architecture variant's Packages file. To do this, this patch changes the code such that the variants indextargets "supplant" the base targets. This may have complicated outcomes on the apt-get indextargets command. 2. Other variants can only be identified by their files being recorded with hashes in the Release file. APT fetches both the base architecture's as well as the variant's Packages file. Variants are configured in the APT::Architecture-Variants list. Image builders may want to build specific variant images using APT::Architecture-Variants { "amd64v3"; } But this commit also implements an automatic discovery mechanism using the varianttable and /proc/cpuinfo. APT::Architecture-Variants "auto";
* Fix indentation compiler warning with clangBiswapriyo Nath2025-08-261-2/+5
| | | | | | This commit fixes the following compiler warning. cacheiterators.h:423:54: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
* Add missing #include <string_view>Julian Andres Klode2025-02-151-0/+1
|
* cache: Introduce partial SourceVersion supportJulian Andres Klode2025-02-151-2/+30
| | | | | | | | | | | | This is the first step that introduces a 1:1 mapping between version and source version. In a future version this can use the fields currently marked unavailable to deduplicate the SourceVersion objects across the group. The policy gains a member for storing pins for sourceversions. Together, in the future we should be able to determine candidates for source versions.
* APT::StringView -> std::string_view [textonly]наб2025-02-141-9/+8
|
* Add DepIterator::IsSatisfied(PkgIterator)Julian Andres Klode2025-02-141-0/+1
| | | | | This allows checking if a dependency is satisfied by all versions of a package.
* Drop APT_DEPRECATED usageDavid Kalnischkies2025-01-051-4/+4
| | | | | | | | C++14 includes the standard attribute, so we can use that instead. Note that we drop the deprecation of {Pkg,Dep}Iterator::operator<< as this is ignored (a friends declaration must be a definition to have attributes) very noisily by GCC >= 12 and the methods can be somewhat useful in debugging if you are to lazy to get APT::Pretty{Pkg,Dep}.
* Modernize standard library includesJulian Andres Klode2024-02-201-1/+1
| | | | | | This was automated with sed and git-clang-format, and then I had to fix up the top of policy.cc by hand as git-clang-format accidentally indented it by two spaces.
* Add public phased update APIJulian Andres Klode2024-02-131-0/+1
| | | | | | | | | | | | | | | | This moves the functions of the PhasedUpgrader class into various other classes so they can be publicly exposed. This introduces three new functions: pkgDepCache::PhasingApplied() tells you whether phasing should be applied to the package. pkgProblemResolver::KeepPhasedUpdates() keeps back updates that have phasing applied. pkgCache::VerIterator::IsSecurityUpdate() determines whether this version contains security fixes.
* Avoid use of deprecated std::iterator (twice)Helmut Grohne2022-03-211-2/+7
| | | | Closes: #1008036
* Avoid undefined pointer arithmetic while growing mmapDavid Kalnischkies2021-02-041-4/+4
| | | | | | | | | The undefined behaviour sanitizer complains with: runtime error: addition of unsigned offset to 0x… overflowed to 0x… Compilers and runtime do the right thing in any case and it is a codepath that can (and ideally should) be avoided for speed reasons alone, but fixing it can't hurt (too much).
* Add support for Phased-Update-PercentageJulian Andres Klode2021-01-081-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* apt-pkg: default visibility to hiddenJulian Andres Klode2020-02-261-11/+11
|
* Make map_pointer<T> typesafeJulian Andres Klode2020-02-241-4/+5
| | | | | | | | | | | 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-241-6/+6
| | | | | | 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.
* Allow querying all binaries built by a source packageJulian Andres Klode2020-01-171-0/+12
| | | | | | This adds a simple way to lookup binaries by a source package, but this adds all binaries into one list, even with different source versions. Be careful.
* Search in all available description translationsАлексей Шилин2019-11-251-0/+1
| | | | | | | | | | | | 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
* Make APT::StringView publicJulian Andres Klode2019-06-111-7/+1
|
* cacheiterators: Cleanup deprecated codeJulian Andres Klode2019-02-261-10/+0
|
* Deprectate buggy/incorrect Rls/PkgFile::IsOk methodsDavid Kalnischkies2018-05-111-0/+2
| | | | | | | | | With the advent of compressed files and especially with in-memory post-processed files the simple assumptions made in IsOk are no longer true. Worse, they are at best duplicates of checks performed by the cache generation (and validation) earlier and isn't used in too many places. It is hence best to simply get right of these calls instead of trying to fix them.
* convert various c-style casts to C++-styleDavid Kalnischkies2017-12-131-2/+2
| | | | | | | | | | gcc was warning about ignored type qualifiers for all of them due to the last 'const', so dropping that and converting to static_cast in the process removes the here harmless warning to avoid hidden real issues in them later on. Reported-By: gcc Gbp-Dch: Ignore
* cacheiterators: Warn about direct include and don't include pkgcache.hJulian Andres Klode2017-07-121-1/+3
| | | | | | This adds a warning so existing working code will still work (as it includes pkgcache.h first anyway), but it will know that it's not right to include this file directly.
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-4/+4
| | | | | | | | | | | | | 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.
* factor out Pkg/DepIterator prettyprinters into own headerDavid Kalnischkies2016-04-281-2/+2
| | | | | | | | | 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.
* deprecate confusing Pkg.CandVersion() methodDavid Kalnischkies2016-04-281-1/+1
| | | | | | | This method does not return the 'current' candidate of the DepCache which would be most expected, but instead returns the version which would be candidate in a default-only policy setting – aka ignoring apt_preferences settings and co.
* Switch performance critical code to use APT::StringViewJulian Andres Klode2016-01-071-0/+7
| | | | | | This improves performance of the cache generation on my ARM platform (4x Cortex A15) by about 10% to 20% from 2.35-2.50 to 2.1 seconds.
* add messages to our deprecation warnings in libaptDavid Kalnischkies2015-11-271-2/+2
| | | | Git-Dch: Ignore
* fix various typos reported by codespellDavid Kalnischkies2015-08-271-1/+1
| | | | Reported-By: codespell
* Drop the Section field from pkgCache::Package againJulian Andres Klode2015-08-121-5/+3
| | | | | | This somehow got back, we don't really know why. Emulate the Section() method in the PkgIterator by looking at the section of the head of the VersionList.
* Drop C++11 elements from headersJulian Andres Klode2015-08-111-2/+2
|
* hide implicit deps in apt-cache again by defaultDavid Kalnischkies2015-08-101-2/+16
| | | | | | | | | | | | | | Before MultiArch implicits weren't a thing, so they were hidden by default by definition. Adding them for MultiArch solved many problems, but having no reliable way of detecting which dependency (and provides) is implicit or not causes problems everytime we want to output dependencies without confusing our observers with unneeded implementation details. The really notworthy point here is actually that we keep now a better record of how a dependency came to be so that we can later reason about it more easily, but that is hidden so deep down in the library internals that change is more the problems it solves than the change itself.
* remove the compatibility markers for 4.13 abiDavid Kalnischkies2015-08-101-3/+1
| | | | | | | | We aren't and we will not be really compatible again with the previous stable abi, so lets drop these markers (which never made it into a released version) for good as they have outlived their intend already. Git-Dch: Ignore
* link DependencyData structs togetherDavid Kalnischkies2015-08-101-2/+3
| | | | | | | | | Cache generation needs a way of quickly iterating over the unique potion of the dependencies to be able to share them. By linking them together we can reduce the speed penality (~ 80%) with only a small reduction in saved size (~ 20%). Git-Dch: Ignore
* split-up Dependency structDavid Kalnischkies2015-08-101-9/+34
| | | | | | | | | | | | | | | | | | | | | 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
* avoid virtual in the iteratorsDavid Kalnischkies2015-08-101-51/+39
| | | | | | | | 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
* cleanup Container.erase API to look more like std::containersDavid Kalnischkies2015-08-101-1/+0
| | | | | | | | C++11 slightly changes the API again to const_iterator, but we are find with iterators in the C++03 style for now as long as they look and behave equally to the methods of the standard containers. Git-Dch: Ignore
* apply various style suggestions by cppcheckDavid Kalnischkies2015-08-101-4/+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-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* merge debian/sid into debian/experimentalDavid Kalnischkies2015-03-161-4/+6
|\
| * deprecate the Section member from package structDavid Kalnischkies2014-11-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. 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 …). Backport of 7a66977 which actually instantly removes the member.
* | guard ABI changes for SourcePkg/Ver in pkgCacheDavid Kalnischkies2014-11-081-0/+2
| | | | | | | | Git-Dch: Ignore
* | store source name and version in binary cacheDavid Kalnischkies2014-09-271-0/+6
| | | | | | | | | | | | | | Accessing the package records to acquire this information is pretty costly, so that information wasn't used so far in many places. The most noticeable user by far is EDSP at the moment, but there are ideas to change that which this commit tries to enable.
* | deprecate Pkg->Name in favor of Grp->NameDavid Kalnischkies2014-09-271-2/+2
| | | | | | | | | | | | | | They both store the same information, so this field just takes up space in the Package struct for no good reason. We mark it "just" as deprecated instead of instantly removing it though as it isn't misleading like Section was and is potentially used in the wild more often.
* | remove the Section member from package structDavid Kalnischkies2014-06-181-1/+5
|/ | | | | | | | | | | | | | | | | | 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 …).
* follow method attribute suggestions by gccDavid Kalnischkies2014-03-131-17/+18
| | | | | Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn}
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-0/+4
| | | | | | | | 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: cast from type A to type B casts away qualifiers [-Wcast-qual]David Kalnischkies2014-03-131-1/+1
| | | | | Git-Dch: Ignore Reported-By: gcc -Wcast-qual
* warning: extra ‘;’ [-Wpedantic]David Kalnischkies2014-03-131-113/+113
| | | | | Git-Dch: Ignore Reported-By: gcc -Wpedantic
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-3/+3
|