Skip to contentSkip to conversation

devtool-source.bbclass: Only create each patch branch once

PATCH Superseded Olof Johansson 1 participant 1 message Oct 19, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 devtool-source.bbclass: Only create each patch branch once

For conditonally applied patches based on SRC_URI overrides, the devtool-source class would try to create a new branch for each override assignment as a postfunc to do_patch, but if the same override was used multiple times, it would try to create the same branch multiple times, causing errors like

Quoted 1 line

Exception: bb.process.ExecutionError: Execution of

\ 'git checkout f0f0f0f0f0ff0f0f0f0f0f0f0f0f0f0f0ff0f0f0 -b devtool-override-foo'
\ failed with exit code 128:

Quoted 1 line

fatal: A branch named 'devtool-override-foo' already exists.

This change makes sure that the devtool-source bbclass will only create one branch per override.

Change-Id I8adca0b54179793ca92478ad5b3b1b6e0448e26b
---
 meta/classes/devtool-source.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/devtool-source.bbclass +3 -3
index 67cd0bafb20..1372e32c9e5 100644
@@ -183,14 +183,14 @@ python devtool_post_patch() {
 
     extra_overrides = d.getVar('DEVTOOL_EXTRA_OVERRIDES')
     if extra_overrides:
-        extra_override_list = extra_overrides.split(':')
+        extra_overrides = set(extra_overrides.split(':'))
         devbranch = d.getVar('DEVTOOL_DEVBRANCH')
         default_overrides = d.getVar('OVERRIDES').split(':')
         no_overrides = []
         # First, we may have some overrides that are referred to in the recipe set in
         # our configuration, so we need to make a branch that excludes those
         for override in default_overrides:
-            if override not in extra_override_list:
+            if override not in extra_overrides:
                 no_overrides.append(override)
         if default_overrides != no_overrides:
             # Some overrides are active in the current configuration, so
@@ -208,7 +208,7 @@ python devtool_post_patch() {
         else:
             bb.process.run('git checkout %s -b devtool-no-overrides' % devbranch, cwd=srcsubdir)
 
-        for override in extra_override_list:
+        for override in extra_overrides:
             localdata = bb.data.createCopy(d)
             if override in default_overrides:
                 bb.process.run('git branch devtool-override-%s %s' % (override, devbranch), cwd=srcsubdir)
Signature · 1 line
2.11.0