diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-05-18 16:08:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-19 11:58:45 +0100 |
commit | ba0546bfaf23aa5ba1033e348a0a1addf0623abb (patch) | |
tree | 342dcd1c9631aa4aa08dae3c8383c5929fd341b7 /bitbake/lib/bb | |
parent | 0d9c45289aa121dddeca154b13ce1c0863d0e918 (diff) | |
download | poky-ba0546bfaf23aa5ba1033e348a0a1addf0623abb.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 rev: 0b0c82f49cf2de887967d305768cbd95314bb171)
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: |