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.py85
1 files changed, 44 insertions, 41 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index a5063f57a9..a4239f1cd2 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -336,48 +336,51 @@ def upgrade(args, config, basepath, workspace):
336 raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename) 336 raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename)
337 337
338 tinfoil = setup_tinfoil(basepath=basepath, tracking=True) 338 tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
339 rd = parse_recipe(config, tinfoil, args.recipename, True)
340 if not rd:
341 return 1
342
343 pn = rd.getVar('PN', True)
344 if pn != args.recipename:
345 logger.info('Mapping %s to %s' % (args.recipename, pn))
346 if pn in workspace:
347 raise DevtoolError("recipe %s is already in your workspace" % pn)
348
349 if args.srctree:
350 srctree = os.path.abspath(args.srctree)
351 else:
352 srctree = standard.get_default_srctree(config, pn)
353
354 standard._check_compatible_recipe(pn, rd)
355 old_srcrev = rd.getVar('SRCREV', True)
356 if old_srcrev == 'INVALID':
357 old_srcrev = None
358 if old_srcrev and not args.srcrev:
359 raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading")
360 if rd.getVar('PV', True) == args.version and old_srcrev == args.srcrev:
361 raise DevtoolError("Current and upgrade versions are the same version")
362
363 rf = None
364 try: 339 try:
365 rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd) 340 rd = parse_recipe(config, tinfoil, args.recipename, True)
366 rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch, 341 if not rd:
367 args.srcrev, args.branch, args.keep_temp, 342 return 1
368 tinfoil, rd) 343
369 rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) 344 pn = rd.getVar('PN', True)
370 except bb.process.CmdError as e: 345 if pn != args.recipename:
371 _upgrade_error(e, rf, srctree) 346 logger.info('Mapping %s to %s' % (args.recipename, pn))
372 except DevtoolError as e: 347 if pn in workspace:
373 _upgrade_error(e, rf, srctree) 348 raise DevtoolError("recipe %s is already in your workspace" % pn)
374 standard._add_md5(config, pn, os.path.dirname(rf)) 349
375 350 if args.srctree:
376 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, 351 srctree = os.path.abspath(args.srctree)
377 copied, config.workspace_path, rd) 352 else:
378 standard._add_md5(config, pn, af) 353 srctree = standard.get_default_srctree(config, pn)
379 logger.info('Upgraded source extracted to %s' % srctree) 354
380 logger.info('New recipe is %s' % rf) 355 standard._check_compatible_recipe(pn, rd)
356 old_srcrev = rd.getVar('SRCREV', True)
357 if old_srcrev == 'INVALID':
358 old_srcrev = None
359 if old_srcrev and not args.srcrev:
360 raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading")
361 if rd.getVar('PV', True) == args.version and old_srcrev == args.srcrev:
362 raise DevtoolError("Current and upgrade versions are the same version")
363
364 rf = None
365 try:
366 rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd)
367 rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch,
368 args.srcrev, args.branch, args.keep_temp,
369 tinfoil, rd)
370 rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd)
371 except bb.process.CmdError as e:
372 _upgrade_error(e, rf, srctree)
373 except DevtoolError as e:
374 _upgrade_error(e, rf, srctree)
375 standard._add_md5(config, pn, os.path.dirname(rf))
376
377 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
378 copied, config.workspace_path, rd)
379 standard._add_md5(config, pn, af)
380 logger.info('Upgraded source extracted to %s' % srctree)
381 logger.info('New recipe is %s' % rf)
382 finally:
383 tinfoil.shutdown()
381 return 0 384 return 0
382 385
383def register_commands(subparsers, context): 386def register_commands(subparsers, context):