summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp
Commit message (Collapse)AuthorAgeFilesLines
* edsp: Write 'Size' to the EDSP filesJulian Andres Klode2025-03-031-2/+5
| | | | | | This allows solvers to optimize by download size; and gives us a better means of interpreting "downloadable" debs (they must have a size > 0 after all).
* Consider 0-size debs not downloadable, set a size in EDSPJulian Andres Klode2025-03-031-0/+2
| | | | | | | | | | | | EDSP dumps all appear as a single file, so we cannot determine correctly if a package is obsolete. We can fix this by ensuring that only debs with a size are downloadable, and then by faking a size in EDSP: The size is 1 if APT-Release is set (there is a source to download it from) or 0 otherwise. This ensures that the obsolete logic in solver3 works correctly, as well as the obsolete patterns, if anyone could actually use it on the EDSP files.
* Add missing #include <string_view>Julian Andres Klode2025-02-151-0/+1
|
* cache: Introduce partial SourceVersion supportJulian Andres Klode2025-02-151-1/+1
| | | | | | | | | | | | 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.
* Drop usage of macro APT_OVERRIDE for simple overrideDavid Kalnischkies2025-01-054-53/+53
| | | | | | | | | 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.
* apt-pkg/edsp/edsplistparser.cc: APT::StringView -> std::string_viewнаб2024-11-122-8/+4
|
* edsp: Parse source version from the Source-Version fieldJulian Andres Klode2024-05-301-1/+14
| | | | | | | | | EDSP uses the Source-Version field instead of storing the source version in the Source field with the package name, adjust our parser accordingly. Use the override in the edspLikeListParser to do so rather than dumb this into the correct place in the debListParser.
* Modernize standard library includesJulian Andres Klode2024-02-202-3/+3
| | | | | | 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.
* Use pkgTagSection::Key in more places in src:aptDavid Kalnischkies2022-04-011-2/+3
| | | | | | | | | | The speed critical paths were converted earlier, but the remaining could benefit a tiny bit from this as well especially as we have the facility now available and can therefore brush up the code in various places in the process as well. Also takes the time to add the hidden Exists method advertised in the headers, but previously not implemented.
* Stop parsing undocumented unknown EDSP field APT-HashDavid Kalnischkies2022-04-011-3/+1
| | | | | | | It was introduced in the first commit for EDSP, but beside this reference, never appears in documentation and code. Seems like an earlier name of what APT-ID ended up to be and as such should be more than safely being able to retire now.
* apt(8): Wait for frontend and cache lockJulian Andres Klode2020-02-262-3/+3
| | | | | | This is a rework of !6 with additional stuff for the frontend lock, so we can lock the frontend lock and then keep looping over dpkg lock.
* Fix various compiler warningsJulian Andres Klode2020-02-261-1/+1
|
* pkgsystem: Drop more virtual workaround shenanigansJulian Andres Klode2020-02-261-0/+8
|
* Make map_pointer<T> typesafeJulian Andres Klode2020-02-241-2/+2
| | | | | | | | | | | 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.
* Use a 32-bit djb VersionHash instead of CRC-16Julian Andres Klode2020-02-182-2/+2
|
* Remove includes of (md5|sha1|sha2).h headersJulian Andres Klode2020-01-142-2/+1
| | | | Remove it everywhere, except where it is still needed.
* Fix typos reported by codespell in code commentsDavid Kalnischkies2019-07-101-2/+2
| | | | | | | | Also in old changelogs, but nothing really user visible like error messages or alike so barely noteworthy. Reported-By: codespell Gbp-Dch: Ignore
* Run unifdef -DAPT_{8,9,10,15}_CLEANER_HEADERSJulian Andres Klode2019-06-122-8/+0
|
* Add 'explicit' to most single argument constructorsJulian Andres Klode2019-04-303-7/+7
| | | | | | | | | | | 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
* Remove obsolete RCS keywordsGuillem Jover2018-05-071-1/+0
| | | | Prompted-by: Jakub Wilk <jwilk@debian.org>
* drop unused/unimplemented & hidden LoadReleaseInfoDavid Kalnischkies2017-09-092-10/+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
* Replace APT_CONST with APT_PURE everywhereJulian Andres Klode2017-08-243-7/+7
| | | | | 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-125-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-123-3/+0
| | | | | Including cacheiterators.h before pkgcache.h fails because pkgcache.h depends on cacheiterators.h.
* fix some unlikely memory leaks in error casesDavid Kalnischkies2017-06-261-6/+7
| | | | | | | | The error cases are just as unlikely as the memory leaks to ever cause real problems, but lets play it safe for correctness. Reported-By: scan-build & clang Gbp-Dch: Ignore
* Do not use MD5SumValue for Description_md5()Julian Andres Klode2016-11-222-3/+7
| | | | | | | | | | | 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%.
* Add missing includes and external definitionsJulian Andres Klode2016-08-261-0/+2
| | | | | | | | | | | | | | | Several modules use std::array without including the array header. Bad modules. Some modules use STDOUT_FILENO and friends, or close() without including unistd.h, where they are defined. One module also uses WIFEXITED() without including sys/wait.h. Finally, environ is not specified to be defined in unistd.h. We are required to define it ourselves according to POSIX, so let's do that.
* eipp: let apt make a plan, not make stuff planeDavid Kalnischkies2016-06-291-1/+1
| | | | | | | | | | | | | | Julian noticed on IRC that I fall victim to a lovely false friend by calling referring to a 'planer' all the time even through these are machines to e.g. remove splinters from woodwork ("make stuff plane"). The term I meant is written in german in this way (= with a single n) but in english there are two, aka: 'planner'. As that is unreleased code switching all instances without any transitional provisions. Also the reason why its skipped in changelog. Thanks: Julian Andres Klode Gbp-Dch: Ignore
* eipp: provide the internal planer as an external oneDavid Kalnischkies2016-06-276-1/+140
| | | | | | Testing the current implementation can benefit from being able to be feed an EIPP request and produce a fully compliant response. It is also a great test for EIPP in general.
* edsp: optionally store a compressed copy of the last scenarioDavid Kalnischkies2016-06-081-0/+3
| | | | | | | | For bugreports and co it could be handy to have the scenario and all the settings used in it around later for inspection for EDSP like protocols. EDSP might not be the most interesting as the user can still interrupt the process before the solution is applied and users tend to have an opinion on the "rightness" of a solution, so it is disabled by default.
* edsp: prevent it from trying to write a cacheDavid Kalnischkies2016-06-061-0/+6
| | | | | | | | | | | | | | | EDSP(-like) protocols are one-shot processes working on data which exists only as long as they run (as they get feed via a pipe), so trying to write a cache for it is pretty pointless, especially as it will usually fail as the cache files tend to be owned by root, but the process is run as a unpriviledged user (either _apt if called by root, otherwise the user of the caller). So this was in fact only observeable with our testcases which run as non-root and the worst which happens is that a valid cache is overridden with an invalid one which the next run will detect and not use. Git-Dch: Ignore
* refactor EDSP classes for better internal reuseDavid Kalnischkies2016-06-056-150/+145
| | | | | | | | | The classes are all marked as hidden, so changing them is no problem ABI wise and will help with introducing protocols similar to EDSP. The change has no observeable behavior difference, its just code juggling. Git-Dch: Ignore
* edsp: use an ID mapping for the internal solverDavid Kalnischkies2016-06-041-1/+2
| | | | | | | Currently an EDSP solver gets send basically all versions which means the absolute count is the same, but that might not be true forever (and with the skipping of rc-only versions it kinda is already) and even if it were true, segfaulting on bad input seems wrong.
* edspsystem.cc: include <stdlib.h> for mkdtempFredrik Fornwall2016-02-031-0/+1
| | | | | | | Include <stdlib.h> to ensure that mkdtemp(3) is defined to improve general portability and fix a specific build failure on Android. Closes: #807367
* remove unused Description methods in listparsersDavid Kalnischkies2016-01-262-8/+3
| | | | | | | These virtual methods are implemented in hidden classes, so we can drop them without breaking the ABI. Git-Dch: Ignore
* wrap every unlink call to check for != /dev/nullDavid Kalnischkies2015-11-042-6/+4
| | | | | | | | | | | | | | | | Unlinking /dev/null is bad, we shouldn't do that. Also, we should print at least a warning if we tried to unlink a file but didn't manage to pull it of (ignoring the case were the file is /dev/null or doesn't exist in the first place). This got triggered by a relatively unlikely to cause problem in pkgAcquire::Worker::PrepareFiles which would while temporary uncompressed files (which are set to keep compressed) figure out that to files are the same and prepare for sharing by deleting them. Bad move. That also shows why not printing a warning is a bad idea as this hide the error for in non-root test runs. Git-Dch: Ignore
* sanify API to get 'the' candidate versionDavid Kalnischkies2015-11-041-0/+9
| | | | | | | | | 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
* use a less generic special trigger filename for stdinDavid Kalnischkies2015-09-142-3/+3
| | | | Git-Dch: Ignore
* implement autobit and pinning in EDSP solver 'apt'David Kalnischkies2015-09-144-8/+94
| | | | | | | | The parser creates a preferences as well as an extended states file based on the EDSP scenario file, which isn't the most efficient way of dealing with this as thes text files have to be parsed again by another layer of the code, but it needs the least changes and works good enough for now. The 'apt' solver is in the end just a test solver like dump.
* Cleanup includes after running iwyuMichael Vogt2015-08-173-8/+0
|
* Annotate more methods with APT_OVERRIDEJulian Andres Klode2015-08-111-1/+1
| | | | | | Gbp-Dch: ignore Reported-By: g++ -Wsuggest-override Thanks: g++ -Wsuggest-override
* parse packages from all architectures into the cacheDavid Kalnischkies2015-08-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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-103-45/+54
| | | | | | | | 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
* add volatile sources support in libapt-pkgDavid Kalnischkies2015-08-101-2/+1
| | | | | | | | | | | | | | | | | | | Sources are usually defined in sources.list (and co) and are pretty stable, but once in a while a frontend might want to add an additional "source" like a local .deb file to install this package (No support for 'real' sources being added this way as this is a multistep process). We had a hack in place to allow apt-get and apt to pull this of for a short while now, but other frontends are either left in the cold by this and/or the code for it looks dirty with FIXMEs plastering it and has on top of this also some problems (like including these 'volatile' sources in the srcpkgcache.bin file). So the biggest part in this commit is actually the rewrite of the cache generation as it is now potentially a three step process. The biggest problem with adding support now through is that this makes a bunch of previously mostly unusable by externs and therefore hidden classes public, so a bit of further tuneing on this now public API is in order…
* add c++11 override marker to overridden methodsDavid Kalnischkies2015-08-104-14/+16
| | | | | | | | | 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-106-11/+7
| | | | | | | | | | | | | | 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-165-1/+8
| | | | | | | | 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
* populate the Architecture field for PackageFilesDavid Kalnischkies2015-06-151-1/+1
| | | | | | | | | | | This is mainly visible in the policy, so that you can now pin by b= and let it only effect Packages files of this architecture and hence the packages coming from it (which do not need to be from this architecture, but very likely are in a normal repository setup). If you should pin by architecture in this way is a different question… Closes: 687255
* store Release files data in the CacheDavid Kalnischkies2015-06-123-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-085-9/+7
| | | | | | | 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.