summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py30
1 files changed, 4 insertions, 26 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index fbffae06fe..e2be38e7af 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -62,26 +62,6 @@ def _get_checksums(rf):
62 checksums[cs] = m.group(1) 62 checksums[cs] = m.group(1)
63 return checksums 63 return checksums
64 64
65def _replace_checksums(rf, md5, sha256):
66 if not md5 and not sha256:
67 return
68 checksums = {'md5sum':md5, 'sha256sum':sha256}
69 with open(rf + ".tmp", "w+") as tmprf:
70 with open(rf) as f:
71 for line in f:
72 m = None
73 for cs in checksums.keys():
74 m = re.match("^SRC_URI\[%s\].*=.*\"(.*)\"" % cs, line)
75 if m:
76 if checksums[cs]:
77 oldcheck = m.group(1)
78 newcheck = checksums[cs]
79 line = line.replace(oldcheck, newcheck)
80 break
81 tmprf.write(line)
82 os.rename(rf + ".tmp", rf)
83
84
85def _remove_patch_dirs(recipefolder): 65def _remove_patch_dirs(recipefolder):
86 for root, dirs, files in os.walk(recipefolder): 66 for root, dirs, files in os.walk(recipefolder):
87 for d in dirs: 67 for d in dirs:
@@ -297,16 +277,14 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
297 if changed: 277 if changed:
298 newvalues['SRC_URI'] = ' '.join(new_src_uri) 278 newvalues['SRC_URI'] = ' '.join(new_src_uri)
299 279
280 if md5 and sha256:
281 newvalues['SRC_URI[md5sum]'] = md5
282 newvalues['SRC_URI[sha256sum]'] = sha256
283
300 if newvalues: 284 if newvalues:
301 rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data) 285 rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data)
302 oe.recipeutils.patch_recipe(rd, fullpath, newvalues) 286 oe.recipeutils.patch_recipe(rd, fullpath, newvalues)
303 287
304 if md5 and sha256:
305 # Unfortunately, oe.recipeutils.patch_recipe cannot update flags.
306 # once the latter feature is implemented, we should call patch_recipe
307 # instead of the following function
308 _replace_checksums(fullpath, md5, sha256)
309
310 return fullpath 288 return fullpath
311 289
312def upgrade(args, config, basepath, workspace): 290def upgrade(args, config, basepath, workspace):