All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] bintool fixes
@ 2025-07-24  8:34 Jerome Forissier
  2025-07-24  8:34 ` [PATCH 1/2] binman: bintool: use apt-get instead of apt Jerome Forissier
  2025-07-24  8:34 ` [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install() Jerome Forissier
  0 siblings, 2 replies; 5+ messages in thread
From: Jerome Forissier @ 2025-07-24  8:34 UTC (permalink / raw)
  To: U-Boot mailing list
  Cc: Jerome Forissier, Alper Nebi Yasak, Leonard Anderweit,
	Simon Glass, Tom Rini

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.


Jerome Forissier (2):
  binman: bintool: use apt-get instead of apt
  binman: bintool: run 'apt update -y' on first invocation of
    apt_install()

 tools/binman/bintool.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.43.0

base-commit: 3532f1f5edfc97c9dcea723cdeb732eda44bc669
branch: bintool-apt-fixes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] binman: bintool: use apt-get instead of apt
  2025-07-24  8:34 [PATCH 0/2] bintool fixes Jerome Forissier
@ 2025-07-24  8:34 ` Jerome Forissier
  2025-07-24  8:34 ` [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install() Jerome Forissier
  1 sibling, 0 replies; 5+ messages in thread
From: Jerome Forissier @ 2025-07-24  8:34 UTC (permalink / raw)
  To: U-Boot mailing list
  Cc: Jerome Forissier, Alper Nebi Yasak, Leonard Anderweit,
	Simon Glass, Tom Rini

The 'apt' command is not meant to be used in scripts or tools. Please
see the man page [1] for details. Therefore, use 'apt-get' instead.
This avoids the following warning:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

[1] https://manpages.debian.org/bookworm/apt/apt.8.en.html#SCRIPT_USAGE_AND_DIFFERENCES_FROM_OTHER_APT_TOOLS

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---

 tools/binman/bintool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 81872db377f..f46bb52a7b3 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -421,7 +421,7 @@ class Bintool:
         Returns:
             True, assuming it completes without error
         """
-        args = ['sudo', 'apt', 'install', '-y', package]
+        args = ['sudo', 'apt-get', 'install', '-y', package]
         print('- %s' % ' '.join(args))
         tools.run(*args)
         return True
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install()
  2025-07-24  8:34 [PATCH 0/2] bintool fixes Jerome Forissier
  2025-07-24  8:34 ` [PATCH 1/2] binman: bintool: use apt-get instead of apt Jerome Forissier
@ 2025-07-24  8:34 ` Jerome Forissier
  2025-07-24  8:48   ` Quentin Schulz
  1 sibling, 1 reply; 5+ messages in thread
From: Jerome Forissier @ 2025-07-24  8:34 UTC (permalink / raw)
  To: U-Boot mailing list
  Cc: Jerome Forissier, Alper Nebi Yasak, Leonard Anderweit,
	Simon Glass, Tom Rini

'apt 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>
---

 tools/binman/bintool.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index f46bb52a7b3..141cc66657c 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 update' 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', '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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install()
  2025-07-24  8:34 ` [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install() Jerome Forissier
@ 2025-07-24  8:48   ` Quentin Schulz
  2025-07-24  8:56     ` Jerome Forissier
  0 siblings, 1 reply; 5+ messages in thread
From: Quentin Schulz @ 2025-07-24  8:48 UTC (permalink / raw)
  To: Jerome Forissier, U-Boot mailing list
  Cc: Alper Nebi Yasak, Leonard Anderweit, Simon Glass, Tom Rini

Hi Jerome,

On 7/24/25 10:34 AM, Jerome Forissier wrote:
> 'apt update -y' may be required to make sure that the list of packages

The previous patch in this series is swapping apt with apt-get and now 
we add apt back, can't we use apt-get update here as well?

Cheers,
Quentin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install()
  2025-07-24  8:48   ` Quentin Schulz
@ 2025-07-24  8:56     ` Jerome Forissier
  0 siblings, 0 replies; 5+ messages in thread
From: Jerome Forissier @ 2025-07-24  8:56 UTC (permalink / raw)
  To: Quentin Schulz, U-Boot mailing list
  Cc: Alper Nebi Yasak, Leonard Anderweit, Simon Glass, Tom Rini

Hi Quentin,

On 7/24/25 10:48, Quentin Schulz wrote:
> Hi Jerome,
> 
> On 7/24/25 10:34 AM, Jerome Forissier wrote:
>> 'apt update -y' may be required to make sure that the list of packages
> 
> The previous patch in this series is swapping apt with apt-get and now we add apt back, can't we use apt-get update here as well?

Indeed, that would make more sense ;) although 'apt update' doesn't
produce any warning. I will update the patch.

> 
> Cheers,
> Quentin

Thanks,
-- 
Jerome

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-24  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24  8:34 [PATCH 0/2] bintool fixes Jerome Forissier
2025-07-24  8:34 ` [PATCH 1/2] binman: bintool: use apt-get instead of apt Jerome Forissier
2025-07-24  8:34 ` [PATCH 2/2] binman: bintool: run 'apt update -y' on first invocation of apt_install() Jerome Forissier
2025-07-24  8:48   ` Quentin Schulz
2025-07-24  8:56     ` Jerome Forissier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.