diff options
Diffstat (limited to 'scripts/lib/devtool/standard.py')
| -rw-r--r-- | scripts/lib/devtool/standard.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index ec21b3c139..700a56b4ed 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
| @@ -25,7 +25,7 @@ import logging | |||
| 25 | import argparse | 25 | import argparse |
| 26 | import scriptutils | 26 | import scriptutils |
| 27 | import errno | 27 | import errno |
| 28 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError | 28 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, DevtoolError |
| 29 | from devtool import parse_recipe | 29 | from devtool import parse_recipe |
| 30 | 30 | ||
| 31 | logger = logging.getLogger('devtool') | 31 | logger = logging.getLogger('devtool') |
| @@ -107,17 +107,26 @@ def add(args, config, basepath, workspace): | |||
| 107 | (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) | 107 | (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) |
| 108 | initial_rev = stdout.rstrip() | 108 | initial_rev = stdout.rstrip() |
| 109 | 109 | ||
| 110 | tinfoil = setup_tinfoil(config_only=True) | ||
| 111 | rd = oe.recipeutils.parse_recipe(recipefile, None, tinfoil.config_data) | ||
| 112 | if not rd: | ||
| 113 | return 1 | ||
| 114 | |||
| 110 | appendfile = os.path.join(appendpath, '%s.bbappend' % bp) | 115 | appendfile = os.path.join(appendpath, '%s.bbappend' % bp) |
| 111 | with open(appendfile, 'w') as f: | 116 | with open(appendfile, 'w') as f: |
| 112 | f.write('inherit externalsrc\n') | 117 | f.write('inherit externalsrc\n') |
| 113 | f.write('EXTERNALSRC = "%s"\n' % srctree) | 118 | f.write('EXTERNALSRC = "%s"\n' % srctree) |
| 114 | if args.same_dir: | 119 | |
| 120 | b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd) | ||
| 121 | if b_is_s: | ||
| 115 | f.write('EXTERNALSRC_BUILD = "%s"\n' % srctree) | 122 | f.write('EXTERNALSRC_BUILD = "%s"\n' % srctree) |
| 116 | if initial_rev: | 123 | if initial_rev: |
| 117 | f.write('\n# initial_rev: %s\n' % initial_rev) | 124 | f.write('\n# initial_rev: %s\n' % initial_rev) |
| 118 | 125 | ||
| 119 | _add_md5(config, args.recipename, appendfile) | 126 | _add_md5(config, args.recipename, appendfile) |
| 120 | 127 | ||
| 128 | tinfoil.shutdown() | ||
| 129 | |||
| 121 | return 0 | 130 | return 0 |
| 122 | 131 | ||
| 123 | 132 | ||
| @@ -483,18 +492,7 @@ def modify(args, config, basepath, workspace): | |||
| 483 | f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') | 492 | f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') |
| 484 | f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) | 493 | f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) |
| 485 | 494 | ||
| 486 | b_is_s = True | 495 | b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd) |
| 487 | if args.no_same_dir: | ||
| 488 | logger.info('using separate build directory since --no-same-dir specified') | ||
| 489 | b_is_s = False | ||
| 490 | elif args.same_dir: | ||
| 491 | logger.info('using source tree as build directory since --same-dir specified') | ||
| 492 | elif bb.data.inherits_class('autotools-brokensep', rd): | ||
| 493 | logger.info('using source tree as build directory since original recipe inherits autotools-brokensep') | ||
| 494 | elif rd.getVar('B', True) == s: | ||
| 495 | logger.info('using source tree as build directory since that is the default for this recipe') | ||
| 496 | else: | ||
| 497 | b_is_s = False | ||
| 498 | if b_is_s: | 496 | if b_is_s: |
| 499 | f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) | 497 | f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) |
| 500 | 498 | ||
| @@ -876,7 +874,9 @@ def register_commands(subparsers, context): | |||
| 876 | description='Adds a new recipe') | 874 | description='Adds a new recipe') |
| 877 | parser_add.add_argument('recipename', help='Name for new recipe to add') | 875 | parser_add.add_argument('recipename', help='Name for new recipe to add') |
| 878 | parser_add.add_argument('srctree', help='Path to external source tree') | 876 | parser_add.add_argument('srctree', help='Path to external source tree') |
| 879 | parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") | 877 | group = parser_add.add_mutually_exclusive_group() |
| 878 | group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") | ||
| 879 | group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") | ||
| 880 | parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree', metavar='URI') | 880 | parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree', metavar='URI') |
| 881 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') | 881 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') |
| 882 | parser_add.set_defaults(func=add) | 882 | parser_add.set_defaults(func=add) |
