From 59682d78f95732e014f78f13e0a05f843860d9bb Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Sat, 23 Jan 2016 00:59:58 +1300 Subject: devtool / recipetool: support specifying a subdirectory within the fetched source Sometimes you don't want to build an entire project, just a subdirectory of it; add a --src-subdir option to make that easier. (We still look for a single subdirectory in what gets unpacked, e.g. what you might find within a tarball, so whatever you specify with this option is added onto the end of that.) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- scripts/lib/recipetool/create.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts/lib/recipetool/create.py') diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 43861ee96b..9c3a63d155 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -324,6 +324,12 @@ def create_recipe(args): srcuri = '' srctree = args.source + if args.src_subdir: + srcsubdir = os.path.join(srcsubdir, args.src_subdir) + srctree_use = os.path.join(srctree, args.src_subdir) + else: + srctree_use = srctree + if args.outfile and os.path.isdir(args.outfile): outfile = None outdir = args.outfile @@ -343,7 +349,7 @@ def create_recipe(args): lines_before.append('# (Feel free to remove these comments when editing.)') lines_before.append('#') - licvalues = guess_license(srctree) + licvalues = guess_license(srctree_use) lic_files_chksum = [] if licvalues: licenses = [] @@ -472,7 +478,7 @@ def create_recipe(args): extravalues = {} for handler in handlers: - handler.process(srctree, classes, lines_before, lines_after, handled, extravalues) + handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) if not realpv: realpv = extravalues.get('PV', None) @@ -759,5 +765,6 @@ def register_commands(subparsers): parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)') parser_create.add_argument('-b', '--binary', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure)', action='store_true') parser_create.add_argument('--also-native', help='Also add native variant (i.e. support building recipe for the build host as well as the target machine)', action='store_true') + parser_create.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', metavar='SUBDIR') parser_create.set_defaults(func=create_recipe) -- cgit 1.2.3-korg