summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'check-missing-dpkg-bin' into 'main'Julian Andres Klode2025-01-142-3/+11
|\ | | | | | | | | apt-pkg/deb/debsystem.cc: Fall back to "dpkg" when Dir::Bin::dpkg is not found See merge request apt-team/apt!419
| * apt-pkg/deb/debsystem.cc: Fall back to "dpkg" when Dir::Bin::dpkg is not foundBalint Reczey2024-12-302-3/+11
| | | | | | | | | | | | The custom dpkg binary may be removed by apt and that breaks the end of the operation. This can be observed when using eatmydata as dpkg and removing the symlink to eatmydata when removing the apt-eatmydata package.
* | Remove leftovers of the apt-key removalDavid Kalnischkies2025-01-051-1/+1
| | | | | | | | References: a00fbbdb28cc31e78882301c2efe7218583ab4cb
* | 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 APT_NORETURN usageDavid Kalnischkies2025-01-051-1/+1
| | | | | | | | | | [[noreturn]] is a C++11 feature and so we can just use it unconditionally.
* | Drop usage of macro APT_OVERRIDE for simple overrideDavid Kalnischkies2025-01-0511-166/+162
| | | | | | | | | | | | | | | | | | 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-052-2/+4
|/ | | | | There were some references to APT::StringView that don't make much sense anymore.
* Fix accidental ABI break in debListParser::ParseDependsJulian Andres Klode2024-11-282-0/+25
| | | | | The version that accepted APT::StringView was marked public.
* Add a --comment option to record Comment: in historyJulian Andres Klode2024-11-181-0/+2
| | | | Suggested-by: mhoye on IRC
* Merge branch 'reefer' into 'main'Julian Andres Klode2024-11-142-26/+18
|\ | | | | | | | | DEFER See merge request apt-team/apt!392
| * fdopen() failing does not close the fdнаб2024-11-141-0/+2
| |
| * DEFER() moreнаб2024-11-142-25/+13
| |
| * DEFERнаб2024-11-141-4/+6
| |
* | (+=)+= -> append().append()наб2024-11-142-3/+3
|/
* apt-pkg/deb/deblistparser.h: APT::StringView -> std::string_viewнаб2024-11-121-6/+5
|
* apt-pkg/deb/deblistparser.cc: APT::StringView -> std::string_viewнаб2024-11-121-30/+31
|
* apt-pkg/deb/debsrcrecords.h: APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/deb/debsrcrecords.cc: APT::StringView -> std::string_viewнаб2024-11-121-12/+12
|
* apt-pkg/pkgcachegen.cc, apt-pkg/pkgcachegen.h: APT::StringView -> ↵наб2024-11-122-37/+37
| | | | std::string_view
* apt-pkg/deb/debrecords.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-20/+20
|
* apt-pkg/deb/debmetaindex.cc: prepare for APT::StringView -> std::string_viewнаб2024-11-121-7/+7
|
* apt-pkg/edsp/edsplistparser.cc: APT::StringView -> std::string_viewнаб2024-11-122-2/+2
|
* dpkgpm: fdopen() failing doesn't close the fdнаб2024-11-121-0/+3
|
* dpkgpm: append ":$printarchitecture" instead of ':'+${#printarchitecture} to ↵наб2024-11-121-1/+1
| | | | package name
* dpkgpm: use getline() for Apport var/crash linesнаб2024-11-121-18/+11
| | | | | Also remove useless condition: sscanf() already direct-matches non-whitespace bytes
* dpkgpm: use std::array<unsigned char, APT_BUFFER_SIZE> for I/O copy buffersнаб2024-11-121-7/+7
|
* dpkgpm: use sysconf(_SC_GETPW_R_SIZE_MAX)-sized + growing buffer for ↵наб2024-11-121-2/+7
| | | | getpwuid_r() instead of 255
* pkgDPkgPMPrivate::dpkgbuf: char[1024] -> array<char, APT_BUFFER_SIZE>наб2024-11-121-8/+8
|
* dpkgpm: lift out CopyIndented() and make_unique_*() for FILEs; use getline() ↵наб2024-11-121-48/+26
| | | | for reading lines instead of 1k buffer
* Do not return error if `Signed-By` value in source list is emptyAristo Chen2024-07-121-0/+2
| | | | Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
* Deal better with spurious spaces in arch restrictionsDavid Kalnischkies2024-05-161-44/+41
| | | | | | | | Another instance of our parser written for sane clean input, but nowadays used also for user-provided input which can contain very many strange formatting and especially white spaces all over the place. Closes: #1071219
* Allow parsing an empty Provides lineDavid Kalnischkies2024-04-261-1/+1
| | | | | | | | | | | | | If dpkg-gencontrol was involved in the creation of a package we will not usually encounter empty or otherwise useless fields, but apparently not everyone is using it. It isn't recommended to have these empty lines, but it isn't too hard to ignore for Provides as we did for dependencies already and apt-ftparchive can be convinced to produce empty files (if you feed it such a package) as well, so lets be nice and provide users with a more accepting parser. Closes: #1069874
* Change the default log level from debug to noticeJulian Andres Klode2024-04-191-1/+1
| | | | | | | | | | We never used the debug level before, so we can do that. This allows us to have the new audit level. We did call DumpErrors() with DEBUG in two debug code paths, so don't touch those. debug
* Allow no spaces for the last dependency in ParseDepends, tooDavid Kalnischkies2024-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | All other entries in a dependency line get substantial leeway about the amount of spaces surrounding the entry itself and its individual parts, but the very last entry was required to have a version constraint be at least 4 chars long (excluding opening bracket and spaces following it), so if the version is short and a single-char relation used a space had to make up for it. This is a bit unfair in comparison to the other entries who do not have such unreasonable demands, so we reduce our demand to 3 chars or longer, which is satisfied by "=1)". If it is a good idea to hate spaces that much remains unanswered by this commit, but in practice most tools (re)writing the files we parse will include spaces, so its only in files (or on the satisfy command line) directly edited by users that we can encounter such a situation, which is a relatively new development given this line came unchanged from the introduction of this method in 1998. LP: #2061834
* Revert "debrecords: Do not reparse if given same location"Julian Andres Klode2024-03-222-14/+3
| | | | This reverts commit 9bb953fddae0246a4dcedddb769d75d3521e1f2f.
* debrecords: Do not reparse if given same locationJulian Andres Klode2024-03-222-3/+14
| | | | | | | The TagFile parser will have already parsed further and can't go back so it needs to reopen the file if compressed. Closes: #1067440
* Parse unsupported != relation in dependenciesDavid Kalnischkies2024-03-071-1/+11
| | | | | | | | | | | | | | | | | libapt has a NotEquals relation for version constraints in dependencies, which is used internally e.g. in the MultiArch implementation, but this relation is not supported by Debian policy and as such can not be used in packages. Our parser here is extremely accepting, even unknown relations are parsed as Equals relation – but the version that must match will be a rather strange one… For our own testcases and e.g. on the command line with 'satisfy' it can make sense to have != available… and what strange things apt does parsing unsupported relations is not really much of a concern. Real packages will not have such relations anyhow as we are (mostly) just a consumer, not a producer of packages and index files.
* Delete SHADOWED metaIndex if we don't actually use snapshotsJulian Andres Klode2024-02-201-0/+7
| | | | | | | | This adds a bit more code but avoids any surprises later on by having both the shadowed and non-shadowed meta index in the list. Gbp-Dch: ignore
* Automatically enable snapshots where supportedJulian Andres Klode2024-02-201-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Convert sources.list Snapshot option from opt-in to automatic. If we can find a snapshot server, Snapshot: yes is assumed if a snapshot is specified. On the implementation side, we record automatic snapshot enablement by adding a '?' suffix to the snapshot timestamp, if any is specified, this avoids introducing bugs into the code where we could end up with an empty snapshot. This has an annoying internal implementation caveat: Since we call GetDebReleaseIndexBy() with the SHADOWED option emplaced, if we do not find a server, we need to remove the SHADOWED option again, but we already have inserted a shadowed release index into the list. This will simply insert the release index a second time without the SHADOWED option which in preliminary testing works fine, but it would arguably be more correct to also remove the release index again if we have created it. FIXME: This only has one test case: A source with supported snapshot server is auto-discovered. We should also add a test case where we cannot detect a server and then don't fail in automatic mode.
* Modernize standard library includesJulian Andres Klode2024-02-2011-28/+27
| | | | | | 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.
* Stop calculating Description-md5 if missingJulian Andres Klode2023-10-041-19/+1
| | | | | | | | This avoids the rabbit hole of md5 on FIPS systems, and repositories have moved to including the value as well. Also stop validating the field, this can be an arbitrary string as far as we are concerned.
* 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
* Fix snapshot crashesJulian Andres Klode2023-07-121-1/+3
| | | | | We did not handle multiple components properly, add a contrib component to the test case.
* update: Add notice about missing Signed-By in deb822 sourcesJulian Andres Klode2023-06-271-0/+3
| | | | | | | We want to gently steer users towards having Signed-By for each source such that we can retire a shared keyring across sources which improves resilience against configuration issues and incompetent malicious actors.
* Rework the domain iteration in the host fallbackJulian Andres Klode2023-05-241-3/+18
| | | | | | Separate the determination of the next level domain into its own function and split out the "we found a result" into its own break for improved readability.
* Ensure that Snapshots: no doesn't get overriden by host-name configJulian Andres Klode2023-05-241-7/+3
|
* Seed snapshot servers for well-known hostsJulian Andres Klode2023-05-241-9/+31
| | | | | This will attempt to fallback to a per-server setting if we could not determine a value from the release file.
* Initial support for snapshot servers, apt --snapshot optionJulian Andres Klode2023-05-022-4/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide snapshot support for offical Debian and Ubuntu archives. There are two ways to enable snapshots for sources: 1. Add Snapshot: yes to your sources file ([snapshot=yes]). This will allow you to specify a snapshot to use when updating or installing using the --snapshot,-S option. 2. Add Snapshot: ID to your sources files to request a specific snapshot for this source. Snapshots are discovered using Label and Origin fields in the Release file of the main source, hence you need to have updated the source at least once before you can use snapshots. The Release file may also declare a snapshots server to use, similar to Changelogs, it can contain a Snapshots field with the values: 1. `Snapshots: https://example.com/@SNAPSHOTID@` where `@SNAPSHOTID@` is a placeholder that is replaced with the requested snapshot id 2. `Snapshots: no` to disable snapshot support for this source. Requesting snapshots for this source will result in a failure to load the source. The implementation adds a SHADOWED option to deb source entries, and marks the main entry as SHADOWED when a snapshot has been requested, which will cause it to be updated, but not included in the generated cache. The concern here was that we need to keep generating the shadowed entries because the cleanup in `apt update` deletes any files not queued for download, so we gotta keep downloading the main source. This design is not entirely optimal, but avoids the pitfalls of having to reimplement list cleanup. Gaps: - Ubuntu Pro repositories and PPAs are not yet supported.
* Allow apt to run if no dpkg/status file existsDavid Kalnischkies2022-09-021-0/+7
| | | | | | | | | | | | | | | Not having a dpkg/status file used to be a hard error which from a boostrap perspective is suspect as in the beginning, there is no status so you would need to touch it into existence. We make a difference between factual non-existence and inaccessibility to catch mistakes in which the file is not readable for some reason, the testcase test-bug-254770-segfault-if-cache-not-buildable is an example of this. Note that apt has already figured out at this point that this is a Debian-like system which should have a dpkg/status file. This change does not effect the auto-detection and is not supposed to.
* Report failures back from debSystem::AddStatusFilesDavid Kalnischkies2022-09-021-2/+14
| | | | | | | | | | | | | | | | Failing to properly create the status file class should be reported back to the caller so it can proceed accordingly instead of proceeding into more failures. This gives us: E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory) E: The package lists or status file could not be parsed or opened. instead of: E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory) E: Could not open file - open (2: No such file or directory) E: Problem opening E: The package lists or status file could not be parsed or opened. and valgrind reporting actions on uninitialised values.