diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-05-22 16:42:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-23 08:21:42 +0100 |
commit | 12cc076832130f9b3a2658bc92458624d2924742 (patch) | |
tree | d612b75014fd7ac58f5246b1f511727775baa8bb /bitbake/lib/bb | |
parent | ca6ef30c7a33b3860d9b0d0da51d9b8786073170 (diff) | |
download | poky-12cc076832130f9b3a2658bc92458624d2924742.tar.gz |
bitbake: lib/bb/utils: fix several bugs in edit_metadata_file()
* 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)
(Bitbake rev: cd92e5dce5f5d61ecb7838bf964a7812e905509a)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/utils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 1681efd7e5..0db7e56651 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -974,6 +974,7 @@ def edit_metadata_file(meta_file, variables, func): | |||
974 | 974 | ||
975 | updated = False | 975 | updated = False |
976 | varset_start = '' | 976 | varset_start = '' |
977 | varlines = [] | ||
977 | newlines = [] | 978 | newlines = [] |
978 | in_var = None | 979 | in_var = None |
979 | full_value = '' | 980 | full_value = '' |
@@ -1001,14 +1002,19 @@ def edit_metadata_file(meta_file, variables, func): | |||
1001 | else: | 1002 | else: |
1002 | newlines.append('%s "%s"\n' % (varset_start, newvalue)) | 1003 | newlines.append('%s "%s"\n' % (varset_start, newvalue)) |
1003 | return True | 1004 | return True |
1004 | return False | 1005 | else: |
1006 | # Put the old lines back where they were | ||
1007 | newlines.extend(varlines) | ||
1008 | return False | ||
1005 | 1009 | ||
1006 | with open(meta_file, 'r') as f: | 1010 | with open(meta_file, 'r') as f: |
1007 | for line in f: | 1011 | for line in f: |
1008 | if in_var: | 1012 | if in_var: |
1009 | value = line.rstrip() | 1013 | value = line.rstrip() |
1014 | varlines.append(line) | ||
1010 | full_value += value[:-1] | 1015 | full_value += value[:-1] |
1011 | if value.endswith('"') or value.endswith("'"): | 1016 | if value.endswith('"') or value.endswith("'"): |
1017 | full_value = full_value[:-1] | ||
1012 | if handle_var_end(): | 1018 | if handle_var_end(): |
1013 | updated = True | 1019 | updated = True |
1014 | in_var = None | 1020 | in_var = None |
@@ -1022,11 +1028,13 @@ def edit_metadata_file(meta_file, variables, func): | |||
1022 | if value.endswith('\\'): | 1028 | if value.endswith('\\'): |
1023 | value = value[:-1] | 1029 | value = value[:-1] |
1024 | full_value = value | 1030 | full_value = value |
1031 | varlines = [line] | ||
1032 | in_var = varname | ||
1025 | if value.endswith('"') or value.endswith("'"): | 1033 | if value.endswith('"') or value.endswith("'"): |
1034 | full_value = full_value[:-1] | ||
1026 | if handle_var_end(): | 1035 | if handle_var_end(): |
1027 | updated = True | 1036 | updated = True |
1028 | else: | 1037 | in_var = None |
1029 | in_var = varname | ||
1030 | matched = True | 1038 | matched = True |
1031 | break | 1039 | break |
1032 | if not matched: | 1040 | if not matched: |