summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/standard.py24
-rw-r--r--scripts/lib/devtool/upgrade.py12
2 files changed, 27 insertions, 9 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 5d7e903670..1285974d44 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -45,6 +45,10 @@ def add(args, config, basepath, workspace):
45 if reason: 45 if reason:
46 raise DevtoolError(reason) 46 raise DevtoolError(reason)
47 47
48 # FIXME this ought to be in validate_pn but we're using that in other contexts
49 if '/' in args.recipename:
50 raise DevtoolError('"/" is not a valid character in recipe names')
51
48 srctree = os.path.abspath(args.srctree) 52 srctree = os.path.abspath(args.srctree)
49 if os.path.exists(srctree): 53 if os.path.exists(srctree):
50 if args.fetch: 54 if args.fetch:
@@ -514,6 +518,14 @@ def modify(args, config, basepath, workspace):
514 rd = parse_recipe(config, tinfoil, args.recipename, True) 518 rd = parse_recipe(config, tinfoil, args.recipename, True)
515 if not rd: 519 if not rd:
516 return 1 520 return 1
521
522 pn = rd.getVar('PN', True)
523 if pn != args.recipename:
524 logger.info('Mapping %s to %s' % (args.recipename, pn))
525 if pn in workspace:
526 raise DevtoolError("recipe %s is already in your workspace" %
527 pn)
528
517 recipefile = rd.getVar('FILE', True) 529 recipefile = rd.getVar('FILE', True)
518 appendname = os.path.splitext(os.path.basename(recipefile))[0] 530 appendname = os.path.splitext(os.path.basename(recipefile))[0]
519 if args.wildcard: 531 if args.wildcard:
@@ -524,9 +536,9 @@ def modify(args, config, basepath, workspace):
524 raise DevtoolError("Another variant of recipe %s is already in your " 536 raise DevtoolError("Another variant of recipe %s is already in your "
525 "workspace (only one variant of a recipe can " 537 "workspace (only one variant of a recipe can "
526 "currently be worked on at once)" 538 "currently be worked on at once)"
527 % args.recipename) 539 % pn)
528 540
529 _check_compatible_recipe(args.recipename, rd) 541 _check_compatible_recipe(pn, rd)
530 542
531 initial_rev = None 543 initial_rev = None
532 commits = [] 544 commits = []
@@ -574,11 +586,11 @@ def modify(args, config, basepath, workspace):
574 586
575 f.write('\ninherit externalsrc\n') 587 f.write('\ninherit externalsrc\n')
576 f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') 588 f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n')
577 f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) 589 f.write('EXTERNALSRC_pn-%s = "%s"\n' % (pn, srctree))
578 590
579 b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd) 591 b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd)
580 if b_is_s: 592 if b_is_s:
581 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) 593 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree))
582 594
583 if bb.data.inherits_class('kernel', rd): 595 if bb.data.inherits_class('kernel', rd):
584 f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout do_fetch do_unpack"\n') 596 f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout do_fetch do_unpack"\n')
@@ -587,9 +599,9 @@ def modify(args, config, basepath, workspace):
587 for commit in commits: 599 for commit in commits:
588 f.write('# commit: %s\n' % commit) 600 f.write('# commit: %s\n' % commit)
589 601
590 _add_md5(config, args.recipename, appendfile) 602 _add_md5(config, pn, appendfile)
591 603
592 logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree)) 604 logger.info('Recipe %s now set up to build from %s' % (pn, srctree))
593 605
594 return 0 606 return 0
595 607
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 4f850cf0e4..d38762373e 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -300,7 +300,13 @@ def upgrade(args, config, basepath, workspace):
300 if not rd: 300 if not rd:
301 return 1 301 return 1
302 302
303 standard._check_compatible_recipe(args.recipename, rd) 303 pn = rd.getVar('PN', True)
304 if pn != args.recipename:
305 logger.info('Mapping %s to %s' % (args.recipename, pn))
306 if pn in workspace:
307 raise DevtoolError("recipe %s is already in your workspace" % pn)
308
309 standard._check_compatible_recipe(pn, rd)
304 if rd.getVar('PV', True) == args.version and rd.getVar('SRCREV', True) == args.srcrev: 310 if rd.getVar('PV', True) == args.version and rd.getVar('SRCREV', True) == args.srcrev:
305 raise DevtoolError("Current and upgrade versions are the same version" % version) 311 raise DevtoolError("Current and upgrade versions are the same version" % version)
306 312
@@ -315,11 +321,11 @@ def upgrade(args, config, basepath, workspace):
315 _upgrade_error(e, rf, args.srctree) 321 _upgrade_error(e, rf, args.srctree)
316 except DevtoolError as e: 322 except DevtoolError as e:
317 _upgrade_error(e, rf, args.srctree) 323 _upgrade_error(e, rf, args.srctree)
318 standard._add_md5(config, args.recipename, os.path.dirname(rf)) 324 standard._add_md5(config, pn, os.path.dirname(rf))
319 325
320 af = _write_append(rf, args.srctree, args.same_dir, args.no_same_dir, rev2, 326 af = _write_append(rf, args.srctree, args.same_dir, args.no_same_dir, rev2,
321 config.workspace_path, rd) 327 config.workspace_path, rd)
322 standard._add_md5(config, args.recipename, af) 328 standard._add_md5(config, pn, af)
323 logger.info('Upgraded source extracted to %s' % args.srctree) 329 logger.info('Upgraded source extracted to %s' % args.srctree)
324 return 0 330 return 0
325 331