summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement architecture variantsJulian Andres Klode2025-10-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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";
* debListParser: Cache `essential` and `myArch` moreJulian Andres Klode2025-08-261-2/+2
| | | | | | | | | | | | | | | | | | | Lookup these variables in the constructor once, rather than once per package. This requires a bit of care as debListParser::UsePackage() defaults to "all" for essential when unset, hence we simply change its == "all" comparisons to == "all" || .empty().# This removes any per-paragraph configuration lookups from the file parser. Also parse myArch from ParseProvides down to ParseDepends() as that call ended up causing it to query APT::Architecture *again* since the function we call is static. Together, the removed config lookups safe about 2.3% of cache generation runtime.
* Add missing #include <string_view>Julian Andres Klode2025-02-151-0/+1
|
* Drop APT::StringViewнаб2025-02-141-9/+0
|
* Drop APT_DEPRECATED usageDavid Kalnischkies2025-01-051-5/+6
| | | | | | | | 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}.
* Drop usage of macro APT_OVERRIDE for simple overrideDavid Kalnischkies2025-01-051-23/+23
| | | | | | | | | We were rather inconsistent in using it and as our public headers contain deduction guides (a c++17 feature) it seems silly to try to hide a c++11 feature in a macro, so lets stop this charade and drop the macro and while we are changing all these lines lets apply [[nodiscard]] (another c++17 feature) and other suggestions from clang-tidy and formatting for a little more consistency.
* Ensure we can build with APT_PKG_ABI > 601Julian Andres Klode2025-01-051-1/+2
| | | | | There were some references to APT::StringView that don't make much sense anymore.
* Fix accidental ABI break in debListParser::ParseDependsJulian Andres Klode2024-11-281-0/+7
| | | | | The version that accepted APT::StringView was marked public.
* apt-pkg/deb/deblistparser.h: APT::StringView -> std::string_viewнаб2024-11-121-6/+5
|
* apt-pkg/pkgcachegen.cc, apt-pkg/pkgcachegen.h: APT::StringView -> ↵наб2024-11-121-8/+8
| | | | std::string_view
* apt-pkg/edsp/edsplistparser.cc: APT::StringView -> std::string_viewнаб2024-11-121-1/+1
|
* Compare SHA256 to check if versions are really the sameJulian Andres Klode2023-08-021-0/+10
| | | | | | | | | | | | | If we know both SHA256, and they're different, the packages are. This approach stores the SHA256 only at runtime, avoiding the overhead of storing it on-disk, because when we update repositories we update all of them anyhow. Note that pkgCacheGenerator is hidden, so we can just modify its ABI, hooray. Closes: #931175 LP: #2029268
* Use a 32-bit djb VersionHash instead of CRC-16Julian Andres Klode2020-02-181-2/+2
|
* Remove includes of (md5|sha1|sha2).h headersJulian Andres Klode2020-01-141-1/+0
| | | | Remove it everywhere, except where it is still needed.
* Run unifdef -DAPT_{8,9,10,15}_CLEANER_HEADERSJulian Andres Klode2019-06-121-3/+0
|
* Merge the ParseDepends functionsJulian Andres Klode2019-06-111-29/+12
|
* Make APT::StringView publicJulian Andres Klode2019-06-111-16/+2
|
* CMake: Enforce "override" use on overriden methodsJulian Andres Klode2019-05-061-1/+1
| | | | | This ensures that we do not accidentally stop overriding a method because it's signature changed in an API break.
* Add 'explicit' to most single argument constructorsJulian Andres Klode2019-04-301-3/+3
| | | | | | | | | | | 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
* debListParser: Avoid native arch lookup in ParseDependsJulian Andres Klode2018-12-261-0/+1
| | | | | | | | | | | | | We called low-level ParseDepends without an architecture each time, which means each call looked up the native architecture. Store the native architecture in the class and use that when calling low-level ParseDepends from the high-level ParseDepends(). This improves performance for a cache build from 2.7 to 2.5 seconds for me. Also avoid a call when stripping multiarch, as the native architecture is passed in.
* Remove obsolete RCS keywordsGuillem Jover2018-05-071-1/+0
| | | | Prompted-by: Jakub Wilk <jwilk@debian.org>
* drop unused/unimplemented & hidden LoadReleaseInfoDavid Kalnischkies2017-09-091-3/+0
| | | | | | | | | | | The relevant calling code as well as the implementation for the deb system was removed 2 years ago with the refactoring of release information storage (b07aeb1a6e24825e534167a737043441e871de9f). This commit removes the the unused remains of this change with no practical effect on anybody (expect codesize) as the methods were declared as hidden and hence only libapt could have called it. 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.
* ParseDepends: Support passing the desired architectureNiels Thykier2017-01-021-0/+11
| | | | | | | | | | | This is useful for e.g. Britney, where the Build-Depends would have to be parsed for multiple architectures. With this change, the call can choose the architecture without having to mess with the config. Signed-off-by: Niels Thykier <niels@thykier.net> Closes: #845969 (jak@d.o: made the code compile)
* Do not use MD5SumValue for Description_md5()Julian Andres Klode2016-11-221-1/+4
| | | | | | | | | | | Our profile says we spend about 5% of the time transforming the hex digits into the binary format used by HashsumValue, all for comparing them against the other strings. That makes no sense at all. According to callgrind, this reduces the overall instruction count from 5,3 billion to 5 billion in my example, which roughly matches the 5%.
* debListParser: Convert to use pkgTagSection::Key-based lookupJulian Andres Klode2016-11-221-3/+1
| | | | | | This basically gets rid of 40-50% of the hash table lookups, making things a bit faster that way, and the profiles look far cleaner.
* add hidden config to set packages as Essential/ImportantDavid Kalnischkies2016-11-111-2/+2
| | | | | | | | | | | | | | | | You can pretty much achieve the same with a local dummy package if you want to, but libapt has an inbuilt setting for essential: "apt" which can be overridden with this option as well – it could be helpful in quick tests and what not so adding this alternative shouldn't really hurt much. We aren't going to document them much through as care must be taken in regards to the binary caches as they aren't invalidated by config options alone, so the effects of old settings could still be in them, similar to the other already existing pkgCacheGen option(s). Closes: 767891 Thanks: Anthony Towns for initial patch
* convert Version() and Architecture() to APT::StringViewDavid Kalnischkies2016-01-261-4/+8
| | | | | | Part of hidden classes, so conversion is abi-free. Git-Dch: Ignore
* remove unused Description methods in listparsersDavid Kalnischkies2016-01-261-4/+0
| | | | | | | These virtual methods are implemented in hidden classes, so we can drop them without breaking the ABI. Git-Dch: Ignore
* use APT::StringView for GrabWordDavid Kalnischkies2016-01-151-1/+3
| | | | Git-Dch: Ignore
* debListParser: Convert another ParseDepends to StringViewJulian Andres Klode2016-01-081-1/+3
| | | | | | I overlooked this Gbp-Dch: ignore
* Switch performance critical code to use APT::StringViewJulian Andres Klode2016-01-071-1/+18
| | | | | | 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.
* deblistparser: Make PrioList constJulian Andres Klode2015-10-231-1/+1
| | | | More safety, less writeable memory.
* Do not parse Status fields from remote sourcesJulian Andres Klode2015-08-271-0/+7
| | | | | | | | | | | This could allow an attacker to mark a package as installed in a remote package index, as long as the package was not listed in the dpkg status file. This way, an attacker could force the installation of a package during a dist-upgrade, by providing two packages in an index, an older marked as installed, and a newer - apt would "upgrade" to the newer version.
* parse packages from all architectures into the cacheDavid Kalnischkies2015-08-101-6/+3
| | | | | | | | | | | | | | | | | | | | | | | Now that we can dynamically create dependencies and provides as needed rather than requiring to know with which architectures we will deal before running we can allow the listparser to parse all records rather than skipping records of "unknown" architectures. This can e.g. happen if a user has foreign architecture packages in his status file without dpkg knowing about this architecture (or apt configured in this way). A sideeffect is that now arch:all packages are (correctly) recorded as available from any Packages file, not just from the native one – which has its downsides for the resolver as mixed-arch source packages can appear in different architectures at different times, but that is the problem of the resolver and dealing with it in the parser is at best a hack (and also depends on a helpful repository). Another sideeffect is that his allows :none packages to appear in Packages files again as we don't do any kind of checks now, but given that they aren't really supported (anymore) by anyone we can live with that.
* elimate duplicated code in pkgIndexFile subclassesDavid Kalnischkies2015-08-101-1/+1
| | | | | | | | Trade deduplication of code for a bunch of new virtuals, so it is actually visible how the different indexes behave cleaning up the interface at large in the process. Git-Dch: Ignore
* just-in-time creation for (implicit) ProvidesDavid Kalnischkies2015-08-101-1/+0
| | | | | | | | | | | | | | | | Expecting the worst is easy to code, but has its disadvantages e.g. by creating package structures which otherwise would have never existed. By creating the provides instead at the time a package structure is added we are well prepared for the introduction of partial architectures, massive amounts of M-A:foreign (and :allowed) and co as far as provides are concerned at least. We have something relatively similar for dependencies already. Many tests are added for both M-A states and the code cleaned to properly support implicit provides for foreign architectures and architectures we 'just' happen to parse. Git-Dch: Ignore
* remove the compatibility markers for 4.13 abiDavid Kalnischkies2015-08-101-2/+0
| | | | | | | | 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
* add c++11 override marker to overridden methodsDavid Kalnischkies2015-08-101-17/+17
| | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | 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
* 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.
* mark internal interfaces as hiddenDavid Kalnischkies2014-11-081-9/+9
| | | | | | | We have a bunch of classes which are of no use for the outside world, but were still exported and so needed to preserve ABI/API. Marking them as hidden to not export them any longer is a big API break in theory, but in practice nobody is using them – as if they would its a bug.
* use a abi version check similar to the gcc checkDavid Kalnischkies2014-11-081-1/+1
| | | | Git-Dch: Ignore
* do not inline virtual destructors with d-pointersDavid Kalnischkies2014-10-131-1/+1
| | | | | | | | | | | | | | Reimplementing an inline method is opening a can of worms we don't want to open if we ever want to us a d-pointer in those classes, so we do the only thing which can save us from hell: move the destructors into the cc sources and we are good. Technically not an ABI break as the methods inline or not do the same (nothing), so a program compiled against the old version still works with the new version (beside that this version is still in experimental, so nothing really has been build against this library anyway). Git-Dch: Ignore
* drop stored StringItems in favor of in-memory mappingsDavid Kalnischkies2014-09-271-1/+0
| | | | | | | | | | | | | | | Strings like Section names or architectures are needed vary often. Instead of writing them each time we need them, we deploy sharing for these special strings. Until now, this was done with a linked list of strings in which we would search, which was stored in the cache. It turns out we can do this just as well in memory as well with a bunch of std::map's. In memory means here that it isn't available anymore if we have a partly invalid cache, but that isn't much of a problem in practice as the status file is compared to the other files we parse very small and includes mostly duplicates, so the space we would gain by storing is more or less equal to the size of the stored linked list…
* cleanup datatypes mix used in binary cacheDavid Kalnischkies2014-06-181-4/+4
| | | | | | | | We had a wild mixture of (unsigned) int, long and long long here without much sense, so this commit adds a few typedefs to get some sense in the typesystem and ensures that a ID isn't sometimes computed as int, stored as long and compared with a long long… as this could potentially bite us later on as the size of the archive only increases over time.
* Merge remote-tracking branch 'upstream/debian/sid' into debian/experimentalMichael Vogt2014-05-291-0/+11
|\ | | | | | | | | Conflicts: test/integration/test-bug-747261-arch-specific-conflicts
| * Never parse Version/Architecture tags in a Translation-$lang fileMichael Vogt2014-05-151-0/+11
| | | | | | | | | | | | | | | | | | | | Version/Architecture information in a Translation-$lang file is not allowed, so don't try to parse it. This is a fix for a bugreport where a Translation-en file contained the content of the regular Packages file (probably due to local FS corruption). This lead to strange error messages on file download. Thanks to Thomas Reusch for the report.
* | parse and retrieve multiple Descriptions in one recordDavid Kalnischkies2014-05-091-2/+2
| | | | | | | | | | | | | | | | It seems unlikely for now that proper archives will carry multiple Description-* stanzas in the Packages (or Translation-*) file, but sometimes apt eats its own output as shown by the usage of the CD team and it would be interesting to let apt output multiple translations e.g. in 'apt-cache show'.
* | WIP local deb installMichael Vogt2014-04-281-3/+12
|/