diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-04-08 15:43:47 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:31 +0100 |
commit | c9c230b14a8202c31648c044e75e47022004014f (patch) | |
tree | 200d1ecf81848c41ff944f8fdba68a884fb3f48f /bitbake/lib/bb/data_smart.py | |
parent | 00e3915ca6b479f78177e16e27ff9ad8a7fbff02 (diff) | |
download | poky-c9c230b14a8202c31648c044e75e47022004014f.tar.gz |
Move update_data into the DataSmart class as a finalize() method
(Bitbake rev: ff801397785567cb84b3615de86bff764d65decf)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 77f1861381..6ea0182852 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -95,6 +95,71 @@ class DataSmart: | |||
95 | 95 | ||
96 | return s | 96 | return s |
97 | 97 | ||
98 | def finalize(self): | ||
99 | """Performs final steps upon the datastore, including application of overrides""" | ||
100 | overrides = (self.getVar("OVERRIDES", True) or "").split(":") | ||
101 | |||
102 | # | ||
103 | # Well let us see what breaks here. We used to iterate | ||
104 | # over each variable and apply the override and then | ||
105 | # do the line expanding. | ||
106 | # If we have bad luck - which we will have - the keys | ||
107 | # where in some order that is so important for this | ||
108 | # method which we don't have anymore. | ||
109 | # Anyway we will fix that and write test cases this | ||
110 | # time. | ||
111 | |||
112 | # | ||
113 | # First we apply all overrides | ||
114 | # Then we will handle _append and _prepend | ||
115 | # | ||
116 | |||
117 | for o in overrides: | ||
118 | # calculate '_'+override | ||
119 | l = len(o)+1 | ||
120 | |||
121 | # see if one should even try | ||
122 | if not self._seen_overrides.has_key(o): | ||
123 | continue | ||
124 | |||
125 | vars = self._seen_overrides[o] | ||
126 | for var in vars: | ||
127 | name = var[:-l] | ||
128 | try: | ||
129 | self.renameVar(var, name) | ||
130 | except: | ||
131 | bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar") | ||
132 | |||
133 | # now on to the appends and prepends | ||
134 | if self._special_values.has_key("_append"): | ||
135 | appends = self._special_values['_append'] or [] | ||
136 | for append in appends: | ||
137 | for (a, o) in self.getVarFlag(append, '_append') or []: | ||
138 | # maybe the OVERRIDE was not yet added so keep the append | ||
139 | if (o and o in overrides) or not o: | ||
140 | self.delVarFlag(append, '_append') | ||
141 | if o and not o in overrides: | ||
142 | continue | ||
143 | |||
144 | sval = self.getVar(append, False) or "" | ||
145 | sval += a | ||
146 | self.setVar(append, sval) | ||
147 | |||
148 | |||
149 | if self._special_values.has_key("_prepend"): | ||
150 | prepends = self._special_values['_prepend'] or [] | ||
151 | |||
152 | for prepend in prepends: | ||
153 | for (a, o) in self.getVarFlag(prepend, '_prepend') or []: | ||
154 | # maybe the OVERRIDE was not yet added so keep the prepend | ||
155 | if (o and o in overrides) or not o: | ||
156 | self.delVarFlag(prepend, '_prepend') | ||
157 | if o and not o in overrides: | ||
158 | continue | ||
159 | |||
160 | sval = a + (self.getVar(prepend, False) or "") | ||
161 | self.setVar(prepend, sval) | ||
162 | |||
98 | def initVar(self, var): | 163 | def initVar(self, var): |
99 | self.expand_cache = {} | 164 | self.expand_cache = {} |
100 | if not var in self.dict: | 165 | if not var in self.dict: |