diff mbox series

[v2,4/4] bitbake-setup: drop get_diff and replace by run_git_diff

Message ID 20260218-improve-bbsetup-readability-v2-4-351584e5df9c@bootlin.com
State New
Headers show
Series bitbake-setup: Improve readability | expand

Commit Message

Antonin Godard Feb. 18, 2026, 1:15 p.m. UTC
We have a new run_git_diff() function that can be used both for showing
diffs in git repositories, but also for printing diffs between two
directories or files, making get_diff() redundant. Replace the single
call to get_diff() by run_git_diff().

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 bin/bitbake-setup | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index e456aa93bf3..56c579d19f7 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -430,7 +430,7 @@  def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c
         bb.process.run("{} -c '. {} && bitbake-config-build enable-fragment {}'".format(shell, init_script, " ".join(fragments)))
 
     if os.path.exists(backup_bitbake_confdir):
-        conf_diff = get_diff(backup_bitbake_confdir, bitbake_confdir)
+        conf_diff = run_git_diff(path1=backup_bitbake_confdir, path2=bitbake_confdir)
         if not conf_diff:
             logger.plain('New bitbake configuration from upstream is the same as the current one, no need to update it.')
             shutil.rmtree(bitbake_confdir)
@@ -759,18 +759,6 @@  def init_config(top_dir, settings, args):
 
     bb.event.remove("bb.build.TaskProgress", None)
 
-def get_diff(file1, file2):
-    try:
-        bb.process.run('diff --color={} -uNr {} {}'.format("always" if BBSETUP_COLOR else "never",
-                                                           file1,
-                                                           file2))
-    except bb.process.ExecutionError as e:
-        if e.exitcode == 1:
-            return e.stdout
-        else:
-            raise e
-    return None
-
 def are_layers_changed(layers, layerdir, d):
     def _is_git_remote_changed(r_remote, repodir):
         changed = False