All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] devtool-source.bbclass: Only create each patch branch once
@ 2018-10-19 16:15 Olof Johansson
  0 siblings, 0 replies; only message in thread
From: Olof Johansson @ 2018-10-19 16:15 UTC (permalink / raw)
  To: openembedded-core

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

> Exception: bb.process.ExecutionError: Execution of
\   'git checkout f0f0f0f0f0ff0f0f0f0f0f0f0f0f0f0f0ff0f0f0 -b devtool-override-foo'
\   failed with exit code 128:
> 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.

Signed-off-by: Olof Johansson <olofjn@axis.com>
Reviewed-by: Peter Kjellerstedt <pkj@axis.com>
---
 meta/classes/devtool-source.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
v1 -> v2: Peter Kjellerstedt pointed out some issues with v1; this updated
change is simpler. In addition to what Richard said about it causing failures
in oe-selftest. I had a issues running oe-selftest, mostly because of the large
storage requirements of /tmp and issues with company internal git hooks.  I
think I managed to run all the tests with passing results now, but please be
vigilante of testcase failures; sorry in advance!

v2 -> v3: it seems i can manage to use git send-email/format-patch properly
today due to serious pebkac issues, sorry for the spam. Remove change-id and
re-add the patch "changelog".


diff --git a/meta/classes/devtool-source.bbclass b/meta/classes/devtool-source.bbclass
index 67cd0bafb20..1372e32c9e5 100644
--- a/meta/classes/devtool-source.bbclass
+++ b/meta/classes/devtool-source.bbclass
@@ -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)
-- 
2.11.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-19 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 16:15 [PATCHv3] devtool-source.bbclass: Only create each patch branch once Olof Johansson

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.