diff options
| author | Jerome Forissier <[email protected]> | 2025-07-24 11:12:41 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-07-29 17:00:07 -0600 |
| commit | 252a2b2750e2df890e044d42e0a530a3e629c9b0 (patch) | |
| tree | c13125e6c81404810513bc0f9b3f57002562dba0 /tools | |
| parent | 2babd34eacfb12f799f8d52a8729139041a18680 (diff) | |
binman: bintool: run 'apt-get update -y' on first invocation of apt_install()
'apt-get update -y' may be required to make sure that the list of
packages is up-to-date and that the subsequent 'apt-get install'
operations can find the requested packages.
Fixes the following CI error:
Fetch: zstd
- trying method: binary download
- sudo apt-get install -y zstd
Exception: Error 100 running 'sudo apt-get install -y zstd': E: Unable to locate package zstd
Signed-off-by: Jerome Forissier <[email protected]>
Reviewed-by: Bryan Brattlof <[email protected]>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/binman/bintool.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index f46bb52a7b3..9c76c8881a4 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -55,6 +55,9 @@ class Bintool: # must be called before this class is used. tooldir = '' + # Flag to run 'apt-get update -y' once on first use of apt_install() + apt_updated = False + def __init__(self, name, desc, version_regex=None, version_args='-V'): self.name = name self.desc = desc @@ -421,6 +424,11 @@ class Bintool: Returns: True, assuming it completes without error """ + if not cls.apt_updated: + args = ['sudo', 'apt-get', 'update', '-y'] + print('- %s' % ' '.join(args)) + tools.run(*args) + cls.apt_updated = True args = ['sudo', 'apt-get', 'install', '-y', package] print('- %s' % ' '.join(args)) tools.run(*args) |
