1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Paul Eggleton
2015-04-28 11:21:55 +01:00
committed by Richard Purdie
parent a4fca1d523
commit 266ea28183
+22 -3
View File
@@ -46,6 +46,19 @@ def add(args, config, basepath, workspace):
return -1
srctree = os.path.abspath(args.srctree)
if os.path.exists(srctree):
if args.fetch:
if not os.path.isdir(srctree):
logger.error("Cannot fetch into source tree path %s as it exists and is not a directory" % srctree)
return 1
elif os.listdir(srctree):
logger.error("Cannot fetch into source tree path %s as it already exists and is non-empty" % srctree)
return 1
else:
if not args.fetch:
logger.error("Specified source tree %s could not be found" % srctree)
return 1
appendpath = os.path.join(config.workspace_path, 'appends')
if not os.path.exists(appendpath):
os.makedirs(appendpath)
@@ -64,7 +77,13 @@ def add(args, config, basepath, workspace):
color = 'always'
else:
color = args.color
stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s %s' % (color, recipefile, srctree))
extracmdopts = ''
if args.fetch:
source = args.fetch
extracmdopts = '-x %s' % srctree
else:
source = srctree
stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts))
logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile)
_add_md5(config, args.recipename, recipefile)
@@ -670,11 +689,11 @@ def build(args, config, basepath, workspace):
def register_commands(subparsers, context):
parser_add = subparsers.add_parser('add', help='Add a new recipe',
description='Adds a new recipe',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
description='Adds a new recipe')
parser_add.add_argument('recipename', help='Name for new recipe to add')
parser_add.add_argument('srctree', help='Path to external source tree')
parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true")
parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create the source tree', metavar='URI')
parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)')
parser_add.set_defaults(func=add)