A couple of fixes for devtool
cover A couple of fixes for devtool
The following changes since commit 0e306a53c460302ec20192fc35930983781b7a2e:
archiver: Improve debug output (2016-04-13 20:58:35 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/devtool16-oe
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/devtool16-oe
Paul Eggleton (2):
devtool: update-recipe: handle where SRC_URI is appended to with +=
devtool: upgrade: handle recipes where source is not first entry in
SRC_URI
meta/lib/oe/recipeutils.py | 7 ++++--- scripts/lib/devtool/upgrade.py | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-)
Signature · 1 line
2.5.5
PATCH 1/2 devtool: update-recipe: handle where SRC_URI is appended to with +=
If a recipe sets SRC_URI and then appends more items to it with += (such as the current rpm recipe in OE-Core), the code in patch_recipe_file() was failing with a traceback. Work around the problem for now by dropping the existing lines if we understand the operation, else just set the value outright at the end. This leaves something to be desired as it either doesn't respect the existing structure or leaves a mess but it's better than the current breakage.
We'll need to come up with a better solution later. Part of the problem is the existing code structure doesn't allow for patch_recipe_file() to know what's being added or removed - it only knows the final value that the caller wants set.
Fixes [YOCTO #9458].
--- meta/lib/oe/recipeutils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oe/recipeutils.py +4 -3
@@ -235,9 +235,10 @@ def patch_recipe_file(fn, values, patch=False, relpath=''): outputvalue(k, newlines, rewindcomments=True) del remainingnames[k] # Now change this variable, if it needs to be changed - if varname in existingnames: - outputvalue(varname, newlines) - del remainingnames[varname] + if varname in existingnames and op in ['+=', '=', '=+']: + if varname in remainingnames: + outputvalue(varname, newlines) + del remainingnames[varname] return None, None, 0, True else: if varname in values:
Signature · 1 line
2.5.5
PATCH 2/2 devtool: upgrade: handle recipes where source is not first entry in SRC_URI
In reply to Paul EggletonIt is unusual but not impossible to find recipes whose first entry is not the main source URL but instead some patch or other local file, for example python-cryptography in meta-python (which sets SRC_URI before inheriting pypi). There's nothing inherently wrong with this, and we shouldn't assume that the first entry is the main source URL, so just take the first non-local entry instead.
--- scripts/lib/devtool/upgrade.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/lib/devtool/upgrade.py +9 -1
@@ -145,7 +145,15 @@ def _get_uri(rd): srcuris = rd.getVar('SRC_URI', True).split() if not len(srcuris): raise DevtoolError('SRC_URI not found on recipe') - srcuri = srcuris[0] # it is assumed, URI is at first position + # Get first non-local entry in SRC_URI - usually by convention it's + # the first entry, but not always! + srcuri = None + for entry in srcuris: + if not entry.startswith('file://'): + srcuri = entry + break + if not srcuri: + raise DevtoolError('Unable to find non-local entry in SRC_URI') srcrev = '${AUTOREV}' if '://' in srcuri: # Fetch a URL
Signature · 1 line
2.5.5