forked from OERV-BSP/u-boot
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 <jerome.forissier@linaro.org> Reviewed-by: Bryan Brattlof <bb@ti.com>
This commit is contained in:
committed by
Tom Rini
parent
2babd34eac
commit
252a2b2750
@@ -55,6 +55,9 @@ class Bintool:
|
|||||||
# must be called before this class is used.
|
# must be called before this class is used.
|
||||||
tooldir = ''
|
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'):
|
def __init__(self, name, desc, version_regex=None, version_args='-V'):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.desc = desc
|
self.desc = desc
|
||||||
@@ -421,6 +424,11 @@ class Bintool:
|
|||||||
Returns:
|
Returns:
|
||||||
True, assuming it completes without error
|
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]
|
args = ['sudo', 'apt-get', 'install', '-y', package]
|
||||||
print('- %s' % ' '.join(args))
|
print('- %s' % ' '.join(args))
|
||||||
tools.run(*args)
|
tools.run(*args)
|
||||||
|
|||||||
Reference in New Issue
Block a user