diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-04-28 11:21:55 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-01 17:08:50 +0100 |
commit | 266ea28183516646195226c9ac3297a5f45d3834 (patch) | |
tree | 13eb50187cfea67aac2342e0d618da66cb49b915 /scripts/lib/devtool/standard.py | |
parent | a4fca1d52386924f25a18f6c4ed94e1a7bbac8e4 (diff) | |
download | poky-266ea28183516646195226c9ac3297a5f45d3834.tar.gz |
devtool: add: add an option to fetch remote source
Add a -f/--fetch option to fetch a remote URI (into the already
specified source tree path) and set this as SRC_URI within the recipe.
This simply wraps around the existing functionality in recipetool.
Implements [YOCTO #7644].
(From OE-Core rev: f22fd77e735fc5f4a3434e3d1f567a9d7d191cf4)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index f90d464432..06b184bca5 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -46,6 +46,19 @@ def add(args, config, basepath, workspace): | |||
46 | return -1 | 46 | return -1 |
47 | 47 | ||
48 | srctree = os.path.abspath(args.srctree) | 48 | srctree = os.path.abspath(args.srctree) |
49 | if os.path.exists(srctree): | ||
50 | if args.fetch: | ||
51 | if not os.path.isdir(srctree): | ||
52 | logger.error("Cannot fetch into source tree path %s as it exists and is not a directory" % srctree) | ||
53 | return 1 | ||
54 | elif os.listdir(srctree): | ||
55 | logger.error("Cannot fetch into source tree path %s as it already exists and is non-empty" % srctree) | ||
56 | return 1 | ||
57 | else: | ||
58 | if not args.fetch: | ||
59 | logger.error("Specified source tree %s could not be found" % srctree) | ||
60 | return 1 | ||
61 | |||
49 | appendpath = os.path.join(config.workspace_path, 'appends') | 62 | appendpath = os.path.join(config.workspace_path, 'appends') |
50 | if not os.path.exists(appendpath): | 63 | if not os.path.exists(appendpath): |
51 | os.makedirs(appendpath) | 64 | os.makedirs(appendpath) |
@@ -64,7 +77,13 @@ def add(args, config, basepath, workspace): | |||
64 | color = 'always' | 77 | color = 'always' |
65 | else: | 78 | else: |
66 | color = args.color | 79 | color = args.color |
67 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s %s' % (color, recipefile, srctree)) | 80 | extracmdopts = '' |
81 | if args.fetch: | ||
82 | source = args.fetch | ||
83 | extracmdopts = '-x %s' % srctree | ||
84 | else: | ||
85 | source = srctree | ||
86 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts)) | ||
68 | logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) | 87 | logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) |
69 | 88 | ||
70 | _add_md5(config, args.recipename, recipefile) | 89 | _add_md5(config, args.recipename, recipefile) |
@@ -670,11 +689,11 @@ def build(args, config, basepath, workspace): | |||
670 | 689 | ||
671 | def register_commands(subparsers, context): | 690 | def register_commands(subparsers, context): |
672 | parser_add = subparsers.add_parser('add', help='Add a new recipe', | 691 | parser_add = subparsers.add_parser('add', help='Add a new recipe', |
673 | description='Adds a new recipe', | 692 | description='Adds a new recipe') |
674 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
675 | parser_add.add_argument('recipename', help='Name for new recipe to add') | 693 | parser_add.add_argument('recipename', help='Name for new recipe to add') |
676 | parser_add.add_argument('srctree', help='Path to external source tree') | 694 | parser_add.add_argument('srctree', help='Path to external source tree') |
677 | parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") | 695 | parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") |
696 | parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree', metavar='URI') | ||
678 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') | 697 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') |
679 | parser_add.set_defaults(func=add) | 698 | parser_add.set_defaults(func=add) |
680 | 699 | ||