← Back to issue list

auto-populate apt-cache if empty?

View original Github issue

Metadata

Project
craft-parts
Number
#292
Type
issue
State
open
Author
stuart-warren
Labels
Created
2022-10-07 12:12:27+00:00
Updated
2026-02-22 19:42:02+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

Hello would it be possible to automatically populate (apt-get update) the apt-cache if it's empty? I realise this may not be a major use case, but I've been running snapcraft within a docker container in ci and it was falling over at https://github.com/canonical/craft-parts/blob/1b8787d74e628e84a358efcdafad2995faa1135a/craft_parts/packages/deb.py#L448 because the apt-cache was empty https://github.com/canonical/craft-parts/blob/1b8787d74e628e84a358efcdafad2995faa1135a/craft_parts/packages/apt_cache.py#L301 you have a method already https://github.com/canonical/craft-parts/blob/1b8787d74e628e84a358efcdafad2995faa1135a/craft_parts/packages/deb.py#L379 ``` 2022-10-07 11:11:00.413 Executing parts lifecycle... 2022-10-07 11:11:00.413 source build packages: {'git'} 2022-10-07 11:11:00.414 source build packages: {'git'} 2022-10-07 11:11:00.414 ignore patterns: ['*.snap', 'parts', 'stage', 'prime'] 2022-10-07 11:11:00.414 part build packages: ['ubuntu-dev-tools', 'grub-pc-bin', 'grub-common', 'sbsigntool'] 2022-10-07 11:11:00.414 plugin build packages: {'make', 'gcc'} 2022-10-07 11:11:00.415 ignore patterns: ['*.snap', 'parts', 'stage', 'prime'] 2022-10-07 11:11:00.415 Requested build-packages: ['gcc', 'git', 'grub-common', 'grub-pc-bin', 'make', 'sbsigntool', 'ubuntu-dev-tools'] 2022-10-07 11:11:00.448 Marking sbsigntool (and its dependencies) to be fetched 2022-10-07 11:11:00.449 Cannot find package listed in 'build-packages': sbsigntool 2022-10-07 11:11:00.450 Traceback (most recent call last): 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 448, in _get_packages_marked_for_installation 2022-10-07 11:11:00.450 apt_cache.mark_packages(set(package_names)) 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/packages/apt_cache.py", line 302, in mark_packages 2022-10-07 11:11:00.450 raise errors.PackageNotFound(name_arch) 2022-10-07 11:11:00.450 craft_parts.packages.errors.PackageNotFound: Package not found: sbsigntool. 2022-10-07 11:11:00.450 2022-10-07 11:11:00.450 During handling of the above exception, another exception occurred: 2022-10-07 11:11:00.450 Traceback (most recent call last): 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/snapcraft/parts/parts.py", line 165, in run 2022-10-07 11:11:00.450 with self._lcm.action_executor() as aex: 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 281, in __enter__ 2022-10-07 11:11:00.450 self._executor.prologue() 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 87, in prologue 2022-10-07 11:11:00.450 self._install_build_packages() 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 222, in _install_build_packages 2022-10-07 11:11:00.450 packages.Repository.install_packages(sorted(build_packages)) 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 505, in install_packages 2022-10-07 11:11:00.450 marked_packages = cls._get_packages_marked_for_installation(package_names) 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 261, in wrapped 2022-10-07 11:11:00.450 return method(*args, **kwargs) 2022-10-07 11:11:00.450 File "/snap/snapcraft/current/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 450, in _get_packages_marked_for_installation 2022-10-07 11:11:00.450 raise errors.BuildPackageNotFound(error.package_name) 2022-10-07 11:11:00.450 craft_parts.packages.errors.BuildPackageNotFound: Cannot find package listed in 'build-packages': sbsigntool ``` many thanks

Evaluation history

No evaluation history available.