diff options
-rw-r--r-- | meta/lib/oe/recipeutils.py | 13 | ||||
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 53 |
2 files changed, 51 insertions, 15 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index cab8e40152..cab94b1350 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py | |||
@@ -22,7 +22,7 @@ from collections import OrderedDict, defaultdict | |||
22 | # Help us to find places to insert values | 22 | # Help us to find places to insert values |
23 | recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()'] | 23 | recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()'] |
24 | # Variables that sometimes are a bit long but shouldn't be wrapped | 24 | # Variables that sometimes are a bit long but shouldn't be wrapped |
25 | nowrap_vars = ['SUMMARY', 'HOMEPAGE', 'BUGTRACKER', 'SRC_URI[md5sum]', 'SRC_URI[sha256sum]'] | 25 | nowrap_vars = ['SUMMARY', 'HOMEPAGE', 'BUGTRACKER', 'SRC_URI\[(.+\.)?md5sum\]', 'SRC_URI\[(.+\.)?sha256sum\]'] |
26 | list_vars = ['SRC_URI', 'LIC_FILES_CHKSUM'] | 26 | list_vars = ['SRC_URI', 'LIC_FILES_CHKSUM'] |
27 | meta_vars = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION'] | 27 | meta_vars = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION'] |
28 | 28 | ||
@@ -142,6 +142,10 @@ def patch_recipe_lines(fromlines, values, trailing_newline=True): | |||
142 | else: | 142 | else: |
143 | newline = '' | 143 | newline = '' |
144 | 144 | ||
145 | nowrap_vars_res = [] | ||
146 | for item in nowrap_vars: | ||
147 | nowrap_vars_res.append(re.compile('^%s$' % item)) | ||
148 | |||
145 | recipe_progression_res = [] | 149 | recipe_progression_res = [] |
146 | recipe_progression_restrs = [] | 150 | recipe_progression_restrs = [] |
147 | for item in recipe_progression: | 151 | for item in recipe_progression: |
@@ -174,7 +178,12 @@ def patch_recipe_lines(fromlines, values, trailing_newline=True): | |||
174 | return | 178 | return |
175 | rawtext = '%s = "%s"%s' % (name, values[name], newline) | 179 | rawtext = '%s = "%s"%s' % (name, values[name], newline) |
176 | addlines = [] | 180 | addlines = [] |
177 | if name in nowrap_vars: | 181 | nowrap = False |
182 | for nowrap_re in nowrap_vars_res: | ||
183 | if nowrap_re.match(name): | ||
184 | nowrap = True | ||
185 | break | ||
186 | if nowrap: | ||
178 | addlines.append(rawtext) | 187 | addlines.append(rawtext) |
179 | elif name in list_vars: | 188 | elif name in list_vars: |
180 | splitvalue = split_var_value(values[name], assignment=False) | 189 | splitvalue = split_var_value(values[name], assignment=False) |
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index ab7acd16c6..6d51958d51 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -55,17 +55,6 @@ def _copy_source_code(orig, dest): | |||
55 | dest_path = os.path.join(dest, path) | 55 | dest_path = os.path.join(dest, path) |
56 | shutil.move(os.path.join(orig, path), dest_path) | 56 | shutil.move(os.path.join(orig, path), dest_path) |
57 | 57 | ||
58 | def _get_checksums(rf): | ||
59 | import re | ||
60 | checksums = {} | ||
61 | with open(rf) as f: | ||
62 | for line in f: | ||
63 | for cs in ['md5sum', 'sha256sum']: | ||
64 | m = re.match("^SRC_URI\[%s\].*=.*\"(.*)\"" % cs, line) | ||
65 | if m: | ||
66 | checksums[cs] = m.group(1) | ||
67 | return checksums | ||
68 | |||
69 | def _remove_patch_dirs(recipefolder): | 58 | def _remove_patch_dirs(recipefolder): |
70 | for root, dirs, files in os.walk(recipefolder): | 59 | for root, dirs, files in os.walk(recipefolder): |
71 | for d in dirs: | 60 | for d in dirs: |
@@ -353,9 +342,47 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil | |||
353 | 342 | ||
354 | newvalues['PR'] = None | 343 | newvalues['PR'] = None |
355 | 344 | ||
345 | # Work out which SRC_URI entries have changed in case the entry uses a name | ||
346 | crd = rd.createCopy() | ||
347 | crd.setVar('PV', newpv) | ||
348 | for var, value in newvalues.items(): | ||
349 | crd.setVar(var, value) | ||
350 | old_src_uri = (rd.getVar('SRC_URI') or '').split() | ||
351 | new_src_uri = (crd.getVar('SRC_URI') or '').split() | ||
352 | newnames = [] | ||
353 | addnames = [] | ||
354 | for newentry in new_src_uri: | ||
355 | _, _, _, _, _, params = bb.fetch2.decodeurl(newentry) | ||
356 | if 'name' in params: | ||
357 | newnames.append(params['name']) | ||
358 | if newentry not in old_src_uri: | ||
359 | addnames.append(params['name']) | ||
360 | # Find what's been set in the original recipe | ||
361 | oldnames = [] | ||
362 | noname = False | ||
363 | for varflag in rd.getVarFlags('SRC_URI'): | ||
364 | if varflag.endswith(('.md5sum', '.sha256sum')): | ||
365 | name = varflag.rsplit('.', 1)[0] | ||
366 | if name not in oldnames: | ||
367 | oldnames.append(name) | ||
368 | elif varflag in ['md5sum', 'sha256sum']: | ||
369 | noname = True | ||
370 | # Even if SRC_URI has named entries it doesn't have to actually use the name | ||
371 | if noname and addnames and addnames[0] not in oldnames: | ||
372 | addnames = [] | ||
373 | # Drop any old names (the name actually might include ${PV}) | ||
374 | for name in oldnames: | ||
375 | if name not in newnames: | ||
376 | newvalues['SRC_URI[%s.md5sum]' % name] = None | ||
377 | newvalues['SRC_URI[%s.sha256sum]' % name] = None | ||
378 | |||
356 | if md5 and sha256: | 379 | if md5 and sha256: |
357 | newvalues['SRC_URI[md5sum]'] = md5 | 380 | if addnames: |
358 | newvalues['SRC_URI[sha256sum]'] = sha256 | 381 | nameprefix = '%s.' % addnames[0] |
382 | else: | ||
383 | nameprefix = '' | ||
384 | newvalues['SRC_URI[%smd5sum]' % nameprefix] = md5 | ||
385 | newvalues['SRC_URI[%ssha256sum]' % nameprefix] = sha256 | ||
359 | 386 | ||
360 | rd = tinfoil.parse_recipe_file(fullpath, False) | 387 | rd = tinfoil.parse_recipe_file(fullpath, False) |
361 | oe.recipeutils.patch_recipe(rd, fullpath, newvalues) | 388 | oe.recipeutils.patch_recipe(rd, fullpath, newvalues) |