]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
devtool: upgrade: call subprocess.run() instead of bb.process.run()
authorDaniel Turull <daniel.turull@ericsson.com>
Fri, 7 Aug 2026 07:03:32 +0000 (09:03 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 10 Aug 2026 16:39:41 +0000 (17:39 +0100)
bb.process.run() is intended for bitbake's own use: it wraps subprocess
with logging behaviour and always decodes command output as UTF-8. The
latter makes _run() raise UnicodeDecodeError on files containing
non-UTF-8 bytes (e.g. Latin-1 author names in a changelog), which
_extract_changelog() hits when reading release notes with `git show`.

Call subprocess.run() directly and decode with errors='replace' to
tolerate that. Keep raising bb.process.ExecutionError so the existing
callers and their error messages are unaffected.

AI-Generated: Kiro with Claude Sonnet 5
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/upgrade.py

index 495a5b821773523856b6a0b8d27453b47bcae2d6..d74ffcf53475b15d4641bed42efffd82977b61d4 100644 (file)
@@ -11,6 +11,7 @@ import sys
 import re
 import shlex
 import shutil
+import subprocess
 import tempfile
 import logging
 import argparse
@@ -64,7 +65,11 @@ _VENDORED_PATH_RE = re.compile(
 
 def _run(cmd, cwd=''):
     logger.debug("Running command %s> %s" % (cwd,cmd))
-    return bb.process.run('%s' % cmd, cwd=cwd)
+    result = subprocess.run(cmd, cwd=cwd or None, shell=True, capture_output=True,
+                            text=True, errors='replace')
+    if result.returncode != 0:
+        raise bb.process.ExecutionError(cmd, result.returncode, result.stdout, result.stderr)
+    return (result.stdout, result.stderr)
 
 def _get_srctree(tmpdir):
     srctree = tmpdir