summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* apt: Use unicode install progress bar on UTF-8 localesJulian Andres Klode2024-04-131-0/+20
| | | | | This produces a much more appealing progress bar and it can even show parts of the progress being done.
* Only show Recommends/Suggests for new installs, not upgradesJulian Andres Klode2024-04-122-6/+0
| | | | | | This makes things more useful in combination with the upgrade command, but introduces a subtle change seen in the test suite when you use the install command to upgrade packages.
* apt: Introduce the new terse apt output format 3.0Julian Andres Klode2024-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The key talking points here are: 1. Instead of long sentences, we use short concise messages, e.g. "The following NEW packages will be installed" becomes "Installing". 2. Dependencies are only listed once. We removed the "The following additional packages will be installed" section in favor of splitting up the "Installing" section into "Installing" and "Installing dependencies" (like dnf) 3. The order of the output is different: 1. Packages to be installed manually 2. Packages to be installed automatically 4. Weak dependencies of new packages not installed 3. Packages to be upgraded 4. Packages to be downgraded 5. Packages that have been kept back / are on hold 6. Removals 7. Essential removals i.e. we logically show you the action that is being done, followed by lists related to the action. 4. As requested by popey, we have colorful UI, with green for packages being installed and red for packages being removed. Caveats: - The list of recommends and suggests has not been updated yet, it should move to after the packages being installed (as they are what triggers them) This also introduces output format versioning, configured by the APT::Output-Format option. The default value is 0, except for the apt(8) binary where it is 30 - which enables the new style.
* Columnar output for package lists similar to 'ls'Christian Blichmann2024-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes it a bit easier to quickly grasp the changes about to be performed by apt. It displays package lists in a columnar format by default, similar to what `ls` produces for files. A new long option `--no-list-columns` and an associated `APT::Get::List-Columns` config setting control the behavior. Usage example, with 60 column wide terminal: ``` $ sudo apt upgrade | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | Calculating upgrade... Done | The following packages were automatically installed and are | no longer required: | libappindicator1 libindicator7 | libdbusmenu-gtk4 linux-image-5.14.0-4-amd64 | Use 'sudo apt autoremove' to remove them. | The following packages have been kept back: | criu linux-headers-amd64 nvidia-settings | libxnvctrl0 nvidia-modprobe xwayland | 0 upgraded, 0 newly installed, 0 to remove and 6 not upgrade| d. | ``` The effect becomes more pronounced with more packages (e.g. when doing a dist-upgrade).
* Revert "Temporarily downgrade key assertions to "soon worthless""Julian Andres Klode2024-04-091-4/+4
| | | | | | | | | | | | | We temporarily downgraded the errors to warnings to give the launchpad PPAs time to be fixed, but warnings are not safe: Untrusted keys could be hiding on your system, but just not used at the moment. Hence revert this so we get the errors we want. This reverts commit 66998ed3d299bede651ad40368bdb270f5f5b0f9. LP: #2060721 Gbp-Dch: full
* Ignore umask of leftover diff_Index in failed pdiff testDavid Kalnischkies2024-03-301-3/+6
| | | | | | | | | | | | | | | We don't store .diff_Index files anymore and so libapt cares even less about these purposefully leftover files from the testcases than it did previously. On a successful apt run they would just be deleted, but as we are testing a failed run they are not touched at all. Testing the file access bits then means we check with whatever umask they were created which might very well be different to what apt decides these files to have if it had touched them, so for this test we just delete them. For the other case we set it completely wrong just in case, but they will (hopefully) be non-existent anyhow as tested first. References: afcdbcf895284efd76903b2b3ba5cc849059ce50
* Avoid subshell hiding failure report from testfilestatsDavid Kalnischkies2024-03-301-3/+4
| | | | | | We remove the working directory from the found file names as these paths could contain a lot of funny characters confusing the for loop like spaces… we just readd it later in the actual calls to be safe.
* Temporarily downgrade key assertions to "soon worthless"Julian Andres Klode2024-02-281-4/+4
| | | | | This will only issue warnings instead of errors while we continue cleaning up our repositories.
* Rename 'weak digest algorithm' to 'weak algorithm'Julian Andres Klode2024-02-282-3/+3
| | | | This allows us to render public key algorithms as weak as well.
* Implement gpgv --assert-pubkey-algo=>=rsa2048,ed25519,ed448Julian Andres Klode2024-02-282-2/+35
| | | | | | | | | | | | 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
* gpgv: Add a reason to worthless signersJulian Andres Klode2024-02-281-4/+5
|
* test-snapshot: Add test case for automatic snapshotJulian Andres Klode2024-02-201-6/+32
| | | | | | 1. repository not supporting snapshots, implicit Enabled 2. repository not supporting snapshots, Enabled: yes 3. URL-based lookup, implicit Enabled
* test-snapshot: Fix a test caseJulian Andres Klode2024-02-201-1/+1
| | | | | | This was accidentally using testfailure instead of testfailureequal, hence trying to run the output string as a command :(
* Automatically enable snapshots where supportedJulian Andres Klode2024-02-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | 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-2016-34/+34
| | | | | | 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 'homar-typo' into 'main'Julian Andres Klode2024-02-202-4/+4
|\ | | | | | | | | Typos in integration tests See merge request apt-team/apt!313
| * Typos in integration testsGábor Németh2024-01-092-4/+4
| | | | | | | | | | | | | | | | Corrected 'und' -> 'and' in the fake package's description. As a result, the MD5 checksum of this string is changed from 36ef2ec58c83bc4fdbe9fe958dd9c107 to 5022766cbc9bf07d1abea2c41a72646f which in turn reduced the size of the resulting Packages.gz by one. Therefore the accepted answer in the test case is updated too.
* | Show a separate list of upgrades deferred due to phasingJulian Andres Klode2024-02-133-11/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new line: The following upgrades have been deferred due to phasing This is any kept back package that is also phasing. This may not be 100% accurate as we have kept it back due to other reasons in an install command, for example, but we don't track for which packages we applied phasing in reality. If additional packages are kept back that are not phasing, show a a notice "N: Some packages may have been kept back due to phasing." LP: #1988819
* | Add the ?security patternJulian Andres Klode2024-02-131-0/+4
| |
* | Add a new ?phasing patternJulian Andres Klode2024-02-131-0/+5
| | | | | | | | | | This selects all packages that are being kept back due to phasing on your system.
* | For phasing, check if current version is a security update, not just ↵Julian Andres Klode2024-02-131-33/+60
| | | | | | | | | | | | | | | | | | 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
* | Accept file system disorder in test-ignored-filesDavid Kalnischkies2024-01-101-13/+12
|/ | | | | | | | Reading the contents of a directory is not deterministic, so if we wanted a fixed order we would need to sort the reported errors, but as we don't need any specific order lets just accept both possibilities. Regression-of: 7b41275b9da31d6c87bbaa0c9115e224e47b15e1
* Revert "Merge branch 'distclean-doc-an-test' into 'main'"Julian Andres Klode2024-01-081-9/+0
| | | | | This reverts commit 86e6eace1d50527b5a2396290acd1db819b13e26, reversing changes made to 6e43eef9ca8250eb561f2c9af2f4890d674f3911.
* test: Disable valgrind on armhf, incompatible with stack clash protectorJulian Andres Klode2024-01-081-1/+6
| | | | Closes: #1059352
* Merge branch 'distclean-doc-an-test' into 'main'Julian Andres Klode2024-01-081-0/+9
|\ | | | | | | | | Document and test 'distclean' See merge request apt-team/apt!312
| * Test and document 'dist-clean'Gábor Németh2023-12-151-0/+9
| |
* | Merge branch 'fix/dontstorediffindex' into 'main'Julian Andres Klode2024-01-082-17/+46
|\ \ | | | | | | | | | | | | 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-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-031-4/+36
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+43
|/ | | | | | 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/unknownarchconflicts' into 'main'Julian Andres Klode2023-12-081-0/+43
|\ | | | | | | | | 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-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+21
|\ \ | |/ |/| | | | | 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/+21
| | | | | | | | | | | | | | | | Enforce helper.canNotGetVersion to show error if no version matched. Regression-of: 572810e9f321237873d1536c88991d7825c6f1db Closes: #1053887
* | Fix the test suite by adding new "m" flags to debug outputJulian Andres Klode2023-11-225-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In "Restore ?garbage by calling MarkAndSweep before parsing" I made install code run MarkAndSweep before parsing arguments such that the "?garbage" pattern works correctly. This caused test suite breakage because packages now ended up with marked flags in the debug output. Hence add "m" to the output we assert where necessary. In a nicer world we might want to just do MarkAndSweep if we actually have a ?garbage pattern to evaluate but that is a bit unpredictable in terms of performance expectations and because a "read-only" construct modifies the depcache, so let's go with the more expected option for now Regression-of: b6f362e8013b03efce54e7381e0e22fac1fa1539
* | Restore ?garbage by calling MarkAndSweep before parsingJulian Andres Klode2023-11-201-0/+22
| | | | | | | | | | | | This ensures that things work correctly. LP: #1995790
* | Use different variable name in GTest source path detectionDavid Kalnischkies2023-11-181-5/+5
|/ | | | | | | | | | | | | | | | | | | | | | We used GTEST_ROOT, which becomes an issue with 3.27 as that variable would influence find_package behaviour by providing PREFIXES – introduced with potentially mixed-cased name in 3.12. CMake Warning (dev) at test/libapt/CMakeLists.txt:8 (find_package): Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT variables. Run "cmake --help-policy CMP0144" for policy details. Use the cmake_policy command to set the policy and suppress this warning. CMake variable GTEST_ROOT is set to: /usr/src/googletest/googletest For compatibility, find_package is ignoring the variable, but code in a .cmake module might still use it. As using this new feature isn't what we wanted at all, we just use a different variable name to avoid the warning and potential future problems if we would keep using this name.
* Compare SHA256 to check if versions are really the sameJulian Andres Klode2023-08-022-3/+18
| | | | | | | | | | | | | 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
* Merge branch 'pu/ubuntu-bug-2025462' into 'main'Julian Andres Klode2023-07-112-0/+146
|\ | | | | | | | | dist-upgrade: Revert phased updates using keeps only See merge request apt-team/apt!299
| * Do not mark updates for install that are still phasingJulian Andres Klode2023-07-071-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where phased updates gain new dependencies and cause them to be installed despite themselves not being installed. In the cause of investigation, it turned out that we also need to evaluate the candidate version at those early stage rather than the install version (which is only valid *after* MarkInstall). This does not fully resolve the problem: If an update pulls in a phased update, depends are still being installed. Resolving this while ensuring that phased updates cannot uninstall packages requires us to do a minimization of changes by trying to keep back each new install removal and then seeing if any dependency is being broken by it. This is more complex and will happen later.
| * dist-upgrade: Revert phased updates using keeps onlyJulian Andres Klode2023-07-051-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the bug, mutter was kept back due to phasing and the new gnome-shell depended on that, and was therefore kept back as well, however, gnome-shell-common was not broken, and apt decided to continue upgrading it by removing gnome-shell and the ubuntu desktop meta packages. This is potentially a regression of LP#1990586 where we added keep back calls to the start of the dist-upgrade to ensure that we do not mark stuff for upgrade in the first place that depends on phasing updates, however it was generally allowed by the resolver to also do those removals. To fix this, we need to resolve the update normally and then use ResolveByKeepInternal to keep back any changes broken by held back packages. However, doing so breaks test-bug-591882-conkeror because ResolveByKeep keeps back packages for broken Recommends as well, which is not something we generally want to do in a dist-upgrade after we already decided to upgrade it. To circumvent that issue, extend the pkgProblemResolver to allow a package to be policy broken, and mark all packages that already were already going to be policy broken to be allowed to be that, such that we don't try to undo their installs. LP: #2025462
* | update: Add notice about missing Signed-By in deb822 sourcesJulian Andres Klode2023-06-271-0/+12
|/ | | | | | | 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.
* Ensure that Snapshots: no doesn't get overriden by host-name configJulian Andres Klode2023-05-241-0/+4
|
* Seed snapshot servers for well-known hostsJulian Andres Klode2023-05-241-1/+110
| | | | | This will attempt to fallback to a per-server setting if we could not determine a value from the release file.
* Merge branch 'pu/snapshot' into 'main'Julian Andres Klode2023-05-022-0/+302
|\ | | | | | | | | Add --snapshot and --update support See merge request apt-team/apt!291
| * Initial support for snapshot servers, apt --snapshot optionJulian Andres Klode2023-05-021-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Add apt install,upgrade,... -U,--update optionsJulian Andres Klode2023-05-021-0/+111
| | | | | | | | | | This runs update before opening the cache and sources.list for installing/upgrading.
* | Keep "or group" when installing package to satisfy itJacob Kauffmann2023-05-021-0/+45
|/
* Merge branch 'pu/never-sections-matching' into 'main'Julian Andres Klode2023-03-061-1/+1
|\ | | | | | | | | Fix permissions && change section matching in config files to be more gitignore style rightmost match See merge request apt-team/apt!286
| * test-apt-get-update-sourceslist-warning: Fix permissionsJulian Andres Klode2023-02-271-1/+1
| | | | | | | | This test did not work with umask 0002