diff options
Diffstat (limited to 'scripts/lib/recipetool/create_npm.py')
-rw-r--r-- | scripts/lib/recipetool/create_npm.py | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py index 885d5438e3..07fcf4d883 100644 --- a/scripts/lib/recipetool/create_npm.py +++ b/scripts/lib/recipetool/create_npm.py | |||
@@ -164,37 +164,6 @@ class NpmRecipeHandler(RecipeHandler): | |||
164 | lines_before.append(line) | 164 | lines_before.append(line) |
165 | return updated | 165 | return updated |
166 | 166 | ||
167 | def _replace_license_vars(self, srctree, lines_before, handled, extravalues, d): | ||
168 | for item in handled: | ||
169 | if isinstance(item, tuple): | ||
170 | if item[0] == 'license': | ||
171 | del item | ||
172 | break | ||
173 | |||
174 | calledvars = [] | ||
175 | def varfunc(varname, origvalue, op, newlines): | ||
176 | if varname in ['LICENSE', 'LIC_FILES_CHKSUM']: | ||
177 | for i, e in enumerate(reversed(newlines)): | ||
178 | if not e.startswith('#'): | ||
179 | stop = i | ||
180 | while stop > 0: | ||
181 | newlines.pop() | ||
182 | stop -= 1 | ||
183 | break | ||
184 | calledvars.append(varname) | ||
185 | if len(calledvars) > 1: | ||
186 | # The second time around, put the new license text in | ||
187 | insertpos = len(newlines) | ||
188 | handle_license_vars(srctree, newlines, handled, extravalues, d) | ||
189 | return None, None, 0, True | ||
190 | return origvalue, None, 0, True | ||
191 | updated, newlines = bb.utils.edit_metadata(lines_before, ['LICENSE', 'LIC_FILES_CHKSUM'], varfunc) | ||
192 | if updated: | ||
193 | del lines_before[:] | ||
194 | lines_before.extend(newlines) | ||
195 | else: | ||
196 | raise Exception('Did not find license variables') | ||
197 | |||
198 | def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): | 167 | def process(self, srctree, classes, lines_before, lines_after, handled, extravalues): |
199 | import bb.utils | 168 | import bb.utils |
200 | import oe | 169 | import oe |
@@ -228,10 +197,7 @@ class NpmRecipeHandler(RecipeHandler): | |||
228 | 197 | ||
229 | fetchdev = extravalues['fetchdev'] or None | 198 | fetchdev = extravalues['fetchdev'] or None |
230 | deps, optdeps, devdeps = self.get_npm_package_dependencies(data, fetchdev) | 199 | deps, optdeps, devdeps = self.get_npm_package_dependencies(data, fetchdev) |
231 | updated = self._handle_dependencies(d, deps, optdeps, devdeps, lines_before, srctree) | 200 | self._handle_dependencies(d, deps, optdeps, devdeps, lines_before, srctree) |
232 | if updated: | ||
233 | # We need to redo the license stuff | ||
234 | self._replace_license_vars(srctree, lines_before, handled, extravalues, d) | ||
235 | 201 | ||
236 | # Shrinkwrap | 202 | # Shrinkwrap |
237 | localfilesdir = tempfile.mkdtemp(prefix='recipetool-npm') | 203 | localfilesdir = tempfile.mkdtemp(prefix='recipetool-npm') |
@@ -267,13 +233,7 @@ class NpmRecipeHandler(RecipeHandler): | |||
267 | all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) | 233 | all_licenses = list(set([item.replace('_', ' ') for pkglicense in pkglicenses.values() for item in pkglicense])) |
268 | if '&' in all_licenses: | 234 | if '&' in all_licenses: |
269 | all_licenses.remove('&') | 235 | all_licenses.remove('&') |
270 | # Go back and update the LICENSE value since we have a bit more | 236 | extravalues['LICENSE'] = ' & '.join(all_licenses) |
271 | # information than when that was written out (and we know all apply | ||
272 | # vs. there being a choice, so we can join them with &) | ||
273 | for i, line in enumerate(lines_before): | ||
274 | if line.startswith('LICENSE = '): | ||
275 | lines_before[i] = 'LICENSE = "%s"' % ' & '.join(all_licenses) | ||
276 | break | ||
277 | 237 | ||
278 | # Need to move S setting after inherit npm | 238 | # Need to move S setting after inherit npm |
279 | for i, line in enumerate(lines_before): | 239 | for i, line in enumerate(lines_before): |