summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* Allow parsing an empty Provides linemainDavid 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
* Do not upgrade rev-deps ear-marked for removalDavid Kalnischkies2024-04-241-2/+5
| | | | | | | | | | | | We schedule reverse dependencies for an upgrade, but we shouldn't do it if we have ear-marked this package for removal later on. Usually the solver will end up doing the right thing like it already did in the included testcase in the end, but given that before it reaches the right end it explored a bad path which can lead to more installs and removals influencing later decisions or are just too hard for the resolver to undo later on, we can just not explore this path to begin with. References: e077370ffcb3669a50a600e80356c2002e6b176d
* Do not ignore if a cmake execute_process failsDavid Kalnischkies2024-04-241-4/+8
| | | | | | Ignoring errors might lead to failures later on anyhow, but especially with triehash it could also lead to broken builds or other crazy stuff, so lets better be save than sorry.
* The text of notices and audits shall not be boldJulian Andres Klode2024-04-231-2/+4
| | | | | This turned out to be a bit too bold for most of them, given their informational nature.
* Add long-version message "Audit:" instead of "A:"Julian Andres Klode2024-04-221-1/+1
|
* Merge branch 'ui-2.9.2' into 'main'Julian Andres Klode2024-04-223-17/+44
|\ | | | | | | | | UI changes for 2.9.2 See merge request apt-team/apt!343
| * show: Highlight field names and colorize package nameJulian Andres Klode2024-04-192-11/+29
| | | | | | | | We should pass this properly to the TagSection.write()
| * i18n: Use Error:/Warning:/Notice: instead of E:/W:/N:Julian Andres Klode2024-04-191-5/+10
| | | | | | | | | | This allows these bits to be localized, improving user experience for users in different languages.
| * Keep the entire error/warning/notice message boldJulian Andres Klode2024-04-191-0/+4
| | | | | | | | | | This draws a bit more attention, and improves readability vs keeping the color for the entire message.
| * Render notices without (yellow) color, just in boldJulian Andres Klode2024-04-191-1/+1
| | | | | | | | Yellow is a bit odd for notices.
* | Add an audit message for missing InRelease filesJulian Andres Klode2024-04-191-0/+2
| |
* | Change the default log level from debug to noticeJulian Andres Klode2024-04-193-4/+4
| | | | | | | | | | | | | | | | | | | | 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
* | Add an "audit" error levelJulian Andres Klode2024-04-192-0/+30
|/ | | | | This will aggressively highlight out-of-compliance vs the best practices.
* Add APT::Configuration::color helper to colorize thingsJulian Andres Klode2024-04-192-0/+37
|
* 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
* Only erase OpProgress lines in output version 3.0Julian Andres Klode2024-04-151-5/+5
| | | | | While this is an interactive only change that doesn't break parsing someone got unhappy.
* apt: Use unicode install progress bar on UTF-8 localesJulian Andres Klode2024-04-131-1/+11
| | | | | This produces a much more appealing progress bar and it can even show parts of the progress being done.
* Show space estimate for /boot, if separate; or estimate initrd for /usrJulian Andres Klode2024-04-133-1/+61
| | | | | | | | | Calculate an estimate of 110% of the biggest initrd + system.map as the additional space a kernel needs in /boot. If /boot is a different file system than /usr, print the size of the kernels + the additional space they will need separately; otherwise include it in our /usr figure.
* OpProgress: Erase lines when doneJulian Andres Klode2024-04-121-4/+7
| | | | | | | | | | | It's interesting to the user to see the progress when it happens, but arguably once it's done it is just visual clutter, so let's not write newlines, and when we are done, instead of appending "Done", let's just empty the line. This requires some effort to keep apt-cdrom happy which just writes lines to stdout itself. Bad apt-cdrom. Maybe there is a better fix for it, but this gets us going.
* 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
* pkgTagFile::Jump: Use lookback buffer to rejump to current positionJulian Andres Klode2024-03-211-0/+5
| | | | | | | | | If we get called twice with the same offset, our d->Start and d->iOffset will already point at the offset for the next section. But since we have the start of the last parsed section still in the buffer, just make sure to always go back to the start first. 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.
* Handle EINTR in the static FileFd::Write overloadDavid Kalnischkies2024-03-051-39/+32
| | | | | | | | | | While the code claims to handle it by just continuing the loop, the looping condition will actually cause a break from the loop failing the interrupted writing. The non-static FileFd::Write (and ::Read) deal with this by setting acceptable values for the loop condition as well – but for more simplicity and consistency we can instead remove this extra loop condition and perform the continue/break due to error handling more explicitly.
* Implement gpgv --assert-pubkey-algo=>=rsa2048,ed25519,ed448Julian Andres Klode2024-02-281-0/+1
| | | | | | | | | | | | The assertion can be overriden using apt::key::assert-pubkey-algo, the default is the most opinionated one. This will inform the user during apt-cdrom add as we do not pass --quiet to user, so adjust test case. Add a simple test case for it to test-method-gpgv. LP: #2055193
* 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-2075-184/+180
| | | | | | 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.
* Merge branch 'prevent_read_conf_inf_loop' into 'main'Julian Andres Klode2024-02-201-1/+1
|\ | | | | | | | | Prevent infinite loop in `ReadConfigFile` See merge request apt-team/apt!314
| * Prevent infinite loop in `ReadConfigFile`Adam Saponara2023-12-291-1/+1
| | | | | | | | | | Break the loop on failure. Without this, the function goes into an infinite loop if `FName` is a directory.
* | Merge branch 'keep-kernel-size' into 'main'Julian Andres Klode2024-02-201-13/+20
|\ \ | | | | | | | | | | | | Configure the amount of kernels to keep See merge request apt-team/apt!324
| * | Configure the amount of kernels to keepWesley Schwengle2024-01-241-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the following configuration for keeping a configurable amount of kernels: APT::NeverAutoRemove::KernelCount The logic dictates that the running kernel and the latest kernel are not autoremoved. In case the running kernel is the latest kernel, the previous kernel is kept. Any count lower than two is therefore disregarded. This is in line with the previous behavior. The default is therefore similar to: APT::NeverAutoRemove::KernelCount 2; This will be ignored and we will still keep two: APT::NeverAutoRemove::KernelCount 1; This will keep 3 kernels (including the runnig, and most recent) APT::NeverAutoRemove::KernelCount 3; Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
* | | Add the ?security patternJulian Andres Klode2024-02-132-0/+11
| | |
* | | Add a new ?phasing patternJulian Andres Klode2024-02-132-0/+12
| | | | | | | | | | | | | | | This selects all packages that are being kept back due to phasing on your system.
* | | Add public phased update APIJulian Andres Klode2024-02-137-110/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | For phasing, check if current version is a security update, not just ↵Julian Andres Klode2024-02-131-1/+0
|/ / | | | | | | | | | | | | | | | | previous ones We only considered an update a security update if a previous update is a security update but not the update in question itself. LP: #2051181
* | pkgcachegen: Use placement new to construct headerJulian Andres Klode2024-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid copying the header from a stack allocated object as this will copy uninitialized padding bytes into the cache, triggering valgrind errors which people then use as a strawman for unrelated errors on armhf. In an optimal world we should annotate the allocator however such that valgrind actually does treat those bytes as uninitialized and then supress warnings in the harmless places, such that when you then go and try to access it in a place that matters, you do get an error for uninitialized memory. Currently any access within the pool will be considered initialized which is clearly suboptimal. But this is very much a TBD topic and involves annotating the allocator everywhere.
* | Merge branch 'fix/dontstorediffindex' into 'main'Julian Andres Klode2024-01-083-51/+36
|\ \ | | | | | | | | | | | | Do not store .diff_Index files in update See merge request apt-team/apt!316
| * | Do not store .diff_Index files in updateDavid Kalnischkies2024-01-031-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nowadays we only download the index file if we have a non-current file on disk which we want to patch. If that is the case, any index file for patches we could have stored is by definition outdated, so storing those files just takes up disk space. At least, that is the case if we have a Release file – if we don't this commit introduces a needless redownload for such repositories but such repositories are an error by default and if they can't be bothered to provide a Release file its very unlikely they actually ship diffs, so adding detection code for this seems pointless at best.
| * | Improve and test distclean implementationDavid Kalnischkies2024-01-032-29/+12
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The implementation as-is as various smaller/esoteric bugs and inconsistencies like apt-get not supporting them, the option -s being supported in code but not accepted on the command line, the regex not escaping the dot before the file extension and exposing more implementation details to public headers than we actually need. Also comes with a small test case to ensure it actually works. References: bd7c126e3fb1b94e76e0e632c657cea854586844
* / Do not silently ignore directories for reserved file namesJulian Andres Klode2023-12-131-3/+5
|/ | | | | | Files with reserved extensions like .list, .sources, .conf, and .pref should receive notices in their respective directories even if they are directories.
* Merge branch 'fix-959093' into 'main'Julian Andres Klode2023-12-082-13/+64
|\ | | | | | | | | Add 'dist-clean' command to remove packages and list files See merge request apt-team/apt!290
| * Add 'dist-clean' command to remove packages and list filesGábor Németh2023-11-222-13/+64
| | | | | | | | | | | | | | We assume all files in the 'listsdir' are candidates. Keep only files ending with Release, Release.gpg, and InRelease. Closes: #959093
* | Merge branch 'fix/unknownarchconflicts' into 'main'Julian Andres Klode2023-12-081-5/+15
|\ \ | | | | | | | | | | | | Have Grp.FindPreferredPkg return very foreign pkgs as last resort See merge request apt-team/apt!310
| * | Have Grp.FindPreferredPkg return very foreign pkgs as last resortDavid Kalnischkies2023-12-041-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually this method will return the package in the most preferred architecture (e.g. native) as that is usually what the user talks about and also information wise for our internal usage the most dense. Early on in parsing Packages files through it can happen that we encounter stanzas about packages in architectures we are not even configured to know about – we have to collect them anyhow as we might be requested to show info about them or they could be in the status file and we can't ignore stanzas in the status file… trouble is that this method used to not return anything if only such an architecture was present if we later discover other architectures which causes Provides and Conflicts which are added lazily on discovery of an architecture to not be added correctly. The result is like in the testcase that apt could be instructed to install a package without respecting its negative dependencies, which is bad even if its discovered by dpkg and refused. It does only happen with unknown architectures through which mostly happens if you are unlucky (amd64 users tend to be very lucky as that sorts early) and use flat-style repositories containing multiple architectures. Reported-By: Tianyu Chen (billchenchina) on IRC
* | | Merge branch 'main' into 'main'Julian Andres Klode2023-12-081-0/+3
|\ \ \ | |/ / |/| | | | | | | | apt-pkg/cacheset.cc: set ShowErrors to true when no version matched See merge request apt-team/apt!308
| * | apt-pkg/cacheset.cc: set ShowErrors to true when no version matchedTianyu Chen2023-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Enforce helper.canNotGetVersion to show error if no version matched. Regression-of: 572810e9f321237873d1536c88991d7825c6f1db Closes: #1053887
* | | Merge branch 'fix-time-unit-comment' into 'main'Julian Andres Klode2023-11-201-1/+1
|\ \ \ | |/ / |/| | | | | | | | Fix incorrect time unit comment for PulseInterval See merge request apt-team/apt!304
| * | Fix incorrect time unit comment for PulseIntervalsid2023-07-271-1/+1
| | |
* | | Revert "Do not fail on systems running in FIPSmode."Julian Andres Klode2023-10-041-3/+0
| | | | | | | | | | | | This reverts commit 668451def296afeb0c358a7d80ff39dc546defab.