AptCache is marking extra packages for installation on Jammy
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
The unit test `tests/unit/packages/test_apt_cache.py::TestAptStageCache::test_stage_packages` is failing on the Ubuntu 22.04 Github runner. It marks two extra packages for installation - `gcc-13-base` and `libgcc-s1`.
It started failing between 2023-Jul-10 and 2023-Jul-12. There was an [update](https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230710.1) to the Jammy runner in this timeframe.
The test was fixed with https://github.com/canonical/craft-parts/pull/494, but the root cause needs to be investigated.
### To Reproduce
Run the Github CI workflow without the patch in #494.
### part yaml
_No response_
### Relevant log output
```shell
Run make test-units
pytest tests/unit
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.2.0
rootdir: /home/runner/work/craft-parts/craft-parts
configfile: pytest.ini
plugins: requests-mock-1.11.0, mock-3.11.1, hypothesis-6.81.1, cov-4.1.0, check-2.1.5
collected 1682 items
tests/unit/test_actions.py ..... [ 0%]
tests/unit/test_callbacks.py .................. [ 1%]
tests/unit/test_ctl.py ...... [ 1%]
tests/unit/test_dirs.py ... [ 1%]
tests/unit/test_errors.py ................................... [ 3%]
tests/unit/test_features.py ... [ 4%]
tests/unit/test_infos.py ............................................... [ 6%]
...................................................... [ 10%]
tests/unit/test_lifecycle_manager.py ........................... [ 11%]
tests/unit/test_parts.py ............................................... [ 14%]
............... [ 15%]
tests/unit/test_permissions.py ....... [ 15%]
tests/unit/test_sequencer.py ............... [ 16%]
tests/unit/test_steps.py ............... [ 17%]
tests/unit/test_xattrs.py ...... [ 18%]
tests/unit/executor/test_collisions.py ........ [ 18%]
tests/unit/executor/test_environment.py .............. [ 19%]
tests/unit/executor/test_executor.py ........... [ 19%]
tests/unit/executor/test_filesets.py ............................ [ 21%]
tests/unit/executor/test_migration.py ................. [ 22%]
tests/unit/executor/test_organize.py .......... [ 23%]
tests/unit/executor/test_part_handler.py ............................... [ 25%]
............................. [ 26%]
tests/unit/executor/test_replace_attr.py ................ [ 27%]
tests/unit/executor/test_step_handler.py ........ [ 28%]
tests/unit/features/test_parts.py ... [ 28%]
tests/unit/features/overlay/test_executor_environment.py .............. [ 29%]
tests/unit/features/overlay/test_executor_part_handler.py .............. [ 30%]
........................................................................ [ 34%]
..... [ 34%]
tests/unit/features/overlay/test_feature.py . [ 34%]
tests/unit/features/overlay/test_lifecycle_manager.py .................. [ 35%]
.......... [ 36%]
tests/unit/features/overlay/test_parts.py .............................. [ 38%]
........................................ [ 40%]
tests/unit/features/overlay/test_sequencer.py .......................... [ 42%]
... [ 42%]
tests/unit/features/overlay/test_steps.py ................. [ 43%]
tests/unit/features/partitions/test_lifecycle_manager.py ............... [ 44%]
..... [ 44%]
tests/unit/features/partitions/test_parts.py ........................... [ 46%]
..................................... [ 48%]
tests/unit/overlays/test_chroot.py ...... [ 48%]
tests/unit/overlays/test_errors.py ... [ 48%]
tests/unit/overlays/test_layers.py ........................... [ 50%]
tests/unit/overlays/test_overlay_fs.py ................... [ 51%]
tests/unit/overlays/test_overlay_manager.py ............... [ 52%]
tests/unit/overlays/test_overlays.py ........................ [ 53%]
tests/unit/packages/test_apt_cache.py F........... [ 54%]
tests/unit/packages/test_base.py ......... [ 55%]
tests/unit/packages/test_chisel.py .... [ 55%]
tests/unit/packages/test_deb.py ....................................... [ 57%]
tests/unit/packages/test_deb_package.py ..... [ 57%]
tests/unit/packages/test_dnf.py ........................ [ 59%]
tests/unit/packages/test_errors.py ................. [ 60%]
tests/unit/packages/test_normalize.py .................................. [ 62%]
.... [ 62%]
tests/unit/packages/test_platform.py ................ [ 63%]
tests/unit/packages/test_snaps.py ...................................... [ 65%]
... [ 66%]
tests/unit/packages/test_yum.py ........................ [ 67%]
tests/unit/plugins/test_ant_plugin.py ........... [ 68%]
tests/unit/plugins/test_autotools_plugin.py ....... [ 68%]
tests/unit/plugins/test_base.py ... [ 68%]
tests/unit/plugins/test_cmake_plugin.py .......... [ 69%]
tests/unit/plugins/test_dotnet_plugin.py ............. [ 70%]
tests/unit/plugins/test_dump_plugin.py ..... [ 70%]
tests/unit/plugins/test_go_plugin.py ............... [ 71%]
tests/unit/plugins/test_make_plugin.py ....... [ 71%]
tests/unit/plugins/test_maven_plugin.py ................... [ 72%]
tests/unit/plugins/test_meson_plugin.py ................ [ 73%]
tests/unit/plugins/test_nil_plugin.py .... [ 74%]
tests/unit/plugins/test_npm_plugin.py ............................. [ 75%]
tests/unit/plugins/test_plugins.py ................ [ 76%]
tests/unit/plugins/test_properties.py ... [ 76%]
tests/unit/plugins/test_python_plugin.py ........... [ 77%]
tests/unit/plugins/test_rust_plugin.py ....................... [ 78%]
tests/unit/plugins/test_scons_plugin.py ........... [ 79%]
tests/unit/plugins/test_validator.py ..... [ 79%]
tests/unit/sources/test_base.py ............. [ 80%]
tests/unit/sources/test_cache.py .... [ 80%]
tests/unit/sources/test_checksum.py ............. [ 81%]
tests/unit/sources/test_deb_source.py . [ 81%]
tests/unit/sources/test_errors.py .......... [ 82%]
tests/unit/sources/test_file_source.py .. [ 82%]
tests/unit/sources/test_git_source.py .................................. [ 84%]
....... [ 84%]
tests/unit/sources/test_local_source.py .................. [ 85%]
tests/unit/sources/test_rpm_source.py ............ [ 86%]
tests/unit/sources/test_snap_source.py .......... [ 87%]
tests/unit/sources/test_sources.py ..................... [ 88%]
tests/unit/sources/test_tar_source.py ..... [ 88%]
tests/unit/sources/test_zip_source.py ... [ 88%]
tests/unit/state_manager/test_build_state.py ........ [ 89%]
tests/unit/state_manager/test_prime_state.py ....... [ 89%]
tests/unit/state_manager/test_pull_state.py ....... [ 90%]
tests/unit/state_manager/test_reports.py ............... [ 91%]
tests/unit/state_manager/test_stage_state.py ........ [ 91%]
tests/unit/state_manager/test_state_manager.py ......................... [ 93%]
.... [ 93%]
tests/unit/state_manager/test_states.py ..................... [ 94%]
tests/unit/state_manager/test_step_state.py ..................... [ 95%]
tests/unit/utils/test_file_utils.py .................. [ 96%]
tests/unit/utils/test_formatting_utils.py ......... [ 97%]
tests/unit/utils/test_os_utils.py .................................. [ 99%]
tests/unit/utils/test_url_utils.py ......... [100%]
=================================== FAILURES ===================================
____________________ TestAptStageCache.test_stage_packages _____________________
self = <tests.unit.packages.test_apt_cache.TestAptStageCache object at 0x7f37f84c47f0>
tmpdir = local('/tmp/pytest-of-runner/pytest-0/test_stage_packages0')
def test_stage_packages(self, tmpdir):
fetch_dir_path = Path(tmpdir, "debs")
fetch_dir_path.mkdir(exist_ok=True, parents=True)
stage_cache = Path(tmpdir, "cache")
stage_cache.mkdir(exist_ok=True, parents=True)
AptCache.configure_apt("test_stage_packages")
with AptCache(stage_cache=stage_cache) as cache:
package_names = {"pciutils"}
filtered_names = {
"base-files",
"libc6",
"libkmod2",
"libudev1",
"zlib1g",
# dependencies in focal
"dpkg",
"libacl1",
"libbz2-1.0",
"libcrypt1",
"liblzma5",
"libpcre2-8-0",
"libselinux1",
"libzstd1",
"pci.ids",
"perl-base",
"tar",
}
cache.mark_packages(package_names)
cache.unmark_packages(unmark_names=filtered_names)
marked_packages = cache.get_packages_marked_for_installation()
> assert sorted([name for name, _ in marked_packages]) == [
"libpci3",
"pciutils",
]
E AssertionError: assert ['gcc-13-base...', 'pciutils'] == ['libpci3', 'pciutils']
E At index 0 diff: 'gcc-13-base' != 'libpci3'
E Left contains 2 more items, first extra item: 'libpci3'
E Full diff:
E - ['libpci3', 'pciutils']
E + ['gcc-13-base', 'libgcc-s1', 'libpci3', 'pciutils']
tests/unit/packages/test_apt_cache.py:72: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/packages/test_apt_cache.py::TestAptStageCache::test_stage_packages - AssertionError: assert ['gcc-13-base...', 'pciutils'] == ['libpci3', 'pciutils']
At index 0 diff: 'gcc-13-base' != 'libpci3'
Left contains 2 more items, first extra item: 'libpci3'
Full diff:
- ['libpci3', 'pciutils']
+ ['gcc-13-base', 'libgcc-s1', 'libpci3', 'pciutils']
================== 1 failed, 1681 passed in 61.47s (0:01:01) ===================
make: *** [Makefile:109: test-units] Error 1
Error: Process completed with exit code 2.
```
Evaluation history
No evaluation history available.