diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-07 12:25:24 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-07 12:25:24 +0000 |
commit | 7aacc310b58f4347e3763ff04efdbc77f76c7d85 (patch) | |
tree | 4f1476b321653e6d1fbcab03ce2f4332c412e7ee /bitbake | |
parent | c354955d26d34316b3dbf0e2175526838401f3b6 (diff) | |
download | poky-7aacc310b58f4347e3763ff04efdbc77f76c7d85.tar.gz |
bitbake/data_smart: Refactor _append/_prepend code to remove duplication
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 9594feebf3..c8cd8f8739 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -154,42 +154,29 @@ class DataSmart: | |||
154 | bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar") | 154 | bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar") |
155 | 155 | ||
156 | # now on to the appends and prepends | 156 | # now on to the appends and prepends |
157 | if "_append" in self._special_values: | 157 | for op in __setvar_keyword__: |
158 | appends = self._special_values["_append"] or [] | 158 | if op in self._special_values: |
159 | for append in appends: | 159 | appends = self._special_values[op] or [] |
160 | keep = [] | 160 | for append in appends: |
161 | for (a, o) in self.getVarFlag(append, "_append") or []: | 161 | keep = [] |
162 | if o and not o in overrides: | 162 | for (a, o) in self.getVarFlag(append, op) or []: |
163 | keep.append((a ,o)) | 163 | if o and not o in overrides: |
164 | continue | 164 | keep.append((a ,o)) |
165 | 165 | continue | |
166 | sval = self.getVar(append, False) or "" | 166 | |
167 | sval += a | 167 | if op is "_append": |
168 | self.setVar(append, sval) | 168 | sval = self.getVar(append, False) or "" |
169 | # We save overrides that may be applied at some later stage | 169 | sval += a |
170 | if keep: | 170 | self.setVar(append, sval) |
171 | self.setVarFlag(append, "_append", keep) | 171 | elif op is "_prepend": |
172 | else: | 172 | sval = a + (self.getVar(append, False) or "") |
173 | self.delVarFlag(append, "_append") | 173 | self.setVar(append, sval) |
174 | 174 | ||
175 | if "_prepend" in self._special_values: | 175 | # We save overrides that may be applied at some later stage |
176 | prepends = self._special_values["_prepend"] or [] | 176 | if keep: |
177 | for prepend in prepends: | 177 | self.setVarFlag(append, op, keep) |
178 | keep = [] | 178 | else: |
179 | for (a, o) in self.getVarFlag(prepend, "_prepend") or []: | 179 | self.delVarFlag(append, op) |
180 | if o and not o in overrides: | ||
181 | keep.append((a ,o)) | ||
182 | continue | ||
183 | |||
184 | sval = a + (self.getVar(prepend, False) or "") | ||
185 | self.setVar(prepend, sval) | ||
186 | |||
187 | # We save overrides that may be applied at some later stage | ||
188 | if keep: | ||
189 | self.setVarFlag(prepend, "_prepend", keep) | ||
190 | else: | ||
191 | self.delVarFlag(prepend, "_prepend") | ||
192 | |||
193 | 180 | ||
194 | def initVar(self, var): | 181 | def initVar(self, var): |
195 | self.expand_cache = {} | 182 | self.expand_cache = {} |