devtool-source.bbclass: Only create each patch branch once
PATCH 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.
--- meta/classes/devtool-source.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
meta/classes/devtool-source.bbclass +4 -5
@@ -169,16 +169,15 @@ python devtool_post_patch() { except bb.process.ExecutionError: pass - extra_overrides = d.getVar('DEVTOOL_EXTRA_OVERRIDES') - if extra_overrides: - extra_override_list = extra_overrides.split(':') + devtool_overrides = set(d.getVar('DEVTOOL_EXTRA_OVERRIDES').split(':') or []) + if devtool_overrides: 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 devtool_overrides: no_overrides.append(override) if default_overrides != no_overrides: # Some overrides are active in the current configuration, so
@@ -196,7 +195,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 devtool_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
Quoted 15 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Olof Johansson
Sent: den 10 oktober 2018 17:35
To: [email protected]
Subject: [OE-core] [PATCH] devtool-source.bbclass: Only create each patch branch onceFor conditonally applied patches based on
SRC_URIoverrides, the devtool-source class would try to create a new branch for each override assignment as a postfunc todo_patch, but if the same override was used multiple times, it would try to create the same branch multiple times, causing errors likeQuoted 1 line
Exception: bb.process.ExecutionError: Execution of
Quoted 8 lines
\ '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
You probably want to remove the Change-Id before applying this...
Quoted 39 lines
Signed-off-by Olof Johansson <[email protected]>--- meta/classes/devtool-source.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)meta/classes/devtool-source.bbclass +4
-6@@ -169,16 +169,15 @@ python devtool_post_patch() { except bb.process.ExecutionError: pass - extra_overrides = d.getVar('DEVTOOL_EXTRA_OVERRIDES') - if extra_overrides: - extra_override_list = extra_overrides.split(':') + devtool_overrides = set(d.getVar('DEVTOOL_EXTRA_OVERRIDES').split(':') or []) + if devtool_overrides: 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 devtool_overrides: no_overrides.append(override) if default_overrides != no_overrides: # Some overrides are active in the current configuration, so@@ -196,7 +195,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 devtool_overrides: localdata = bb.data.createCopy(d) if override in default_overrides: bb.process.run('git branch devtool-override-%s %s' % (override, devbranch), cwd=srcsubdir) --
Quoted 1 line
2.11.0
//Peter
Quoted 3 lines · Peter Kjellerstedt
Quoted 1 line
Change-Id: I8adca0b54179793ca92478ad5b3b1b6e0448e26b
You probably want to remove the Change-Id before applying this...
Sorry! :( I'll probably forget to remove that again in the future, I should try making git format-patch automatically strip that. Thanks Peter!
Signature · 1 line
olofjn
Quoted 20 lines · Olof Johansson
For conditonally applied patches based on
SRC_URIoverrides, the devtool-source class would try to create a new branch for each override
assignment as a postfunc todo_patch, but if the same override was used
multiple times, it would try to create the same branch multiple times,
causing errors likeQuoted 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.
Quoted 5 lines
Change-Id I8adca0b54179793ca92478ad5b3b1b6e0448e26bSigned-off-by Olof Johansson <[email protected]>--- meta/classes/devtool-source.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
This breaks the oe-selftest devtool tests:
https://autobuilder.yoctoproject.org/typhoon/api/v2/logs/46751/raw
oe-selftest -r devtool
should reproduce.
Cheers,
Richard
Quoted 7 lines · Richard Purdie
This breaks the oe-selftest devtool tests:
https://autobuilder.yoctoproject.org/typhoon/api/v2/logs/46751/raw
oe-selftest -r devtool
should reproduce.
Thanks! Was under the impression that the DEVTOOL_EXTRA_OVERRIDES was initialized to "", but that's not the case. Should it be? A simple fix could be to just add DEVTOOL_EXTRA_OVERRIDES ??= "" to the top of the bbclass. Is that the most appropriate fix? Or should I make sure to handle None values coming back from getVar?
Signature · 1 line
olofjn