summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-07-29 17:00:14 -0600
committerTom Rini <[email protected]>2025-07-29 17:00:14 -0600
commit09974c7a64799909894e6e99d4071190da631088 (patch)
tree72cefe9c5ee7b55b3fcff31388e809c9170a1fa4
parentbb04b7bcf66e5d00a7abdf5c9a76026aa120e0df (diff)
parent252a2b2750e2df890e044d42e0a530a3e629c9b0 (diff)
Merge patch series "bintool fixes"
Jerome Forissier <[email protected]> says: Two small fixes for binman (bintool). The first patch avoids a warning, the second one makes sure the APT package list is up-to-date when running apt_install(). That one fixes a CI issue I encountered. Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--tools/binman/bintool.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 81872db377f..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,7 +424,12 @@ class Bintool:
Returns:
True, assuming it completes without error
"""
- args = ['sudo', 'apt', 'install', '-y', package]
+ 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)
return True