* [1.26][PATCH 0/2] A couple of backports from master
@ 2015-05-22 15:42 Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 1/2] lib/bb/utils: add function to get layer containing a file Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 2/2] lib/bb/utils: fix several bugs in edit_metadata_file() Paul Eggleton
0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-05-22 15:42 UTC (permalink / raw)
To: bitbake-devel
Two patches backported from master: a fix for edit_metadata_file() (only
used by bitbake-layers in 1.26) and an additional utility function.
The following changes since commit 8e0211d121e4cb1124dfe879db751ad00f5c978b:
bitbake-layers: ensure non-extended recipe name is preferred (2015-05-15 18:10:49 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib paule/bbfixes-1.26
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bbfixes-1.26
Paul Eggleton (2):
lib/bb/utils: add function to get layer containing a file
lib/bb/utils: fix several bugs in edit_metadata_file()
lib/bb/utils.py | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [1.26][PATCH 1/2] lib/bb/utils: add function to get layer containing a file
2015-05-22 15:42 [1.26][PATCH 0/2] A couple of backports from master Paul Eggleton
@ 2015-05-22 15:42 ` Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 2/2] lib/bb/utils: fix several bugs in edit_metadata_file() Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-05-22 15:42 UTC (permalink / raw)
To: bitbake-devel
In certain contexts it can be useful to find the layer that a file (e.g.
a recipe) appears in.
Implements [YOCTO #7723].
(Bitbake master rev: 3bf9c8830c5d5eea5502230d5af84ebd87ad5849)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
lib/bb/utils.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index c97f3ef..1681efd 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1097,3 +1097,19 @@ def edit_bblayers_conf(bblayers_conf, add, remove):
return (notadded, notremoved)
+
+def get_file_layer(filename, d):
+ """Determine the collection (as defined by a layer's layer.conf file) containing the specified file"""
+ collections = (d.getVar('BBFILE_COLLECTIONS', True) or '').split()
+ collection_res = {}
+ for collection in collections:
+ collection_res[collection] = d.getVar('BBFILE_PATTERN_%s' % collection, True) or ''
+
+ # Use longest path so we handle nested layers
+ matchlen = 0
+ match = None
+ for collection, regex in collection_res.iteritems():
+ if len(regex) > matchlen and re.match(regex, filename):
+ matchlen = len(regex)
+ match = collection
+ return match
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [1.26][PATCH 2/2] lib/bb/utils: fix several bugs in edit_metadata_file()
2015-05-22 15:42 [1.26][PATCH 0/2] A couple of backports from master Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 1/2] lib/bb/utils: add function to get layer containing a file Paul Eggleton
@ 2015-05-22 15:42 ` Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-05-22 15:42 UTC (permalink / raw)
To: bitbake-devel
* Fix unchanged assignments being dropped if other lines changed
* Fix not passing variable name from single-line assignments to the
function
* Fix not trimming the trailing quote from values
(Bitbake master rev: 0b0c82f49cf2de887967d305768cbd95314bb171)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
lib/bb/utils.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 1681efd..0db7e56 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -974,6 +974,7 @@ def edit_metadata_file(meta_file, variables, func):
updated = False
varset_start = ''
+ varlines = []
newlines = []
in_var = None
full_value = ''
@@ -1001,14 +1002,19 @@ def edit_metadata_file(meta_file, variables, func):
else:
newlines.append('%s "%s"\n' % (varset_start, newvalue))
return True
- return False
+ else:
+ # Put the old lines back where they were
+ newlines.extend(varlines)
+ return False
with open(meta_file, 'r') as f:
for line in f:
if in_var:
value = line.rstrip()
+ varlines.append(line)
full_value += value[:-1]
if value.endswith('"') or value.endswith("'"):
+ full_value = full_value[:-1]
if handle_var_end():
updated = True
in_var = None
@@ -1022,11 +1028,13 @@ def edit_metadata_file(meta_file, variables, func):
if value.endswith('\\'):
value = value[:-1]
full_value = value
+ varlines = [line]
+ in_var = varname
if value.endswith('"') or value.endswith("'"):
+ full_value = full_value[:-1]
if handle_var_end():
updated = True
- else:
- in_var = varname
+ in_var = None
matched = True
break
if not matched:
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-22 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 15:42 [1.26][PATCH 0/2] A couple of backports from master Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 1/2] lib/bb/utils: add function to get layer containing a file Paul Eggleton
2015-05-22 15:42 ` [1.26][PATCH 2/2] lib/bb/utils: fix several bugs in edit_metadata_file() Paul Eggleton
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.