diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-01-07 00:15:52 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-11 15:41:46 +0000 |
commit | ec9016821d5c2a120dcb7e5d4b8cde02c2b45b51 (patch) | |
tree | eb7b023daa216f427c598d8efc47981e8d2a49ed /scripts/lib | |
parent | 99e3872d89432566f0b46347c0d0c2b9177eddf7 (diff) | |
download | poky-ec9016821d5c2a120dcb7e5d4b8cde02c2b45b51.tar.gz |
devtool: add: support adding a native variant
Sometimes you need to build a variant of a recipe for the build
host as well as for the target (i.e. BBCLASSEXTEND = "native"); add a
--also-native command line option to "recipetool create" that enables
this and plumb it through from an identical option for "devtool add".
(We could conceivably do the same for nativesdk, but I felt it might be
confusing within the context of the extensible SDK, where nativesdk
isn't really relevant to the user.)
(From OE-Core rev: f3bea83db173cce921a9a30f04e88b7e3ed98854)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/devtool/standard.py | 3 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 741f0ea91b..7ef0ab8c64 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -139,6 +139,8 @@ def add(args, config, basepath, workspace): | |||
139 | extracmdopts += ' -V %s' % args.version | 139 | extracmdopts += ' -V %s' % args.version |
140 | if args.binary: | 140 | if args.binary: |
141 | extracmdopts += ' -b' | 141 | extracmdopts += ' -b' |
142 | if args.also_native: | ||
143 | extracmdopts += ' --also-native' | ||
142 | 144 | ||
143 | tempdir = tempfile.mkdtemp(prefix='devtool') | 145 | tempdir = tempfile.mkdtemp(prefix='devtool') |
144 | try: | 146 | try: |
@@ -1307,6 +1309,7 @@ def register_commands(subparsers, context): | |||
1307 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') | 1309 | parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') |
1308 | parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") | 1310 | parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true") |
1309 | parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true') | 1311 | parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.', action='store_true') |
1312 | parser_add.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') | ||
1310 | parser_add.set_defaults(func=add) | 1313 | parser_add.set_defaults(func=add) |
1311 | 1314 | ||
1312 | parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', | 1315 | parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', |
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 775be42c11..4f95d7e3ae 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -252,8 +252,14 @@ def create_recipe(args): | |||
252 | if args.name: | 252 | if args.name: |
253 | pn = args.name | 253 | pn = args.name |
254 | if args.name.endswith('-native'): | 254 | if args.name.endswith('-native'): |
255 | if args.also_native: | ||
256 | logger.error('--also-native cannot be specified for a recipe named *-native (*-native denotes a recipe that is already only for native) - either remove the -native suffix from the name or drop --also-native') | ||
257 | sys.exit(1) | ||
255 | classes.append('native') | 258 | classes.append('native') |
256 | elif args.name.startswith('nativesdk-'): | 259 | elif args.name.startswith('nativesdk-'): |
260 | if args.also_native: | ||
261 | logger.error('--also-native cannot be specified for a recipe named nativesdk-* (nativesdk-* denotes a recipe that is already only for nativesdk)') | ||
262 | sys.exit(1) | ||
257 | classes.append('nativesdk') | 263 | classes.append('nativesdk') |
258 | 264 | ||
259 | if pv and pv not in 'git svn hg'.split(): | 265 | if pv and pv not in 'git svn hg'.split(): |
@@ -393,6 +399,22 @@ def create_recipe(args): | |||
393 | line = re.sub('"[^+]*\+', '"%s+' % realpv, line) | 399 | line = re.sub('"[^+]*\+', '"%s+' % realpv, line) |
394 | lines_before.append(line) | 400 | lines_before.append(line) |
395 | 401 | ||
402 | if args.also_native: | ||
403 | lines = lines_after | ||
404 | lines_after = [] | ||
405 | bbclassextend = None | ||
406 | for line in lines: | ||
407 | if line.startswith('BBCLASSEXTEND ='): | ||
408 | splitval = line.split('"') | ||
409 | if len(splitval) > 1: | ||
410 | bbclassextend = splitval[1].split() | ||
411 | if not 'native' in bbclassextend: | ||
412 | bbclassextend.insert(0, 'native') | ||
413 | line = 'BBCLASSEXTEND = "%s"' % ' '.join(bbclassextend) | ||
414 | lines_after.append(line) | ||
415 | if not bbclassextend: | ||
416 | lines_after.append('BBCLASSEXTEND = "native"') | ||
417 | |||
396 | outlines = [] | 418 | outlines = [] |
397 | outlines.extend(lines_before) | 419 | outlines.extend(lines_before) |
398 | if classes: | 420 | if classes: |
@@ -591,5 +613,6 @@ def register_commands(subparsers): | |||
591 | parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)') | 613 | parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)') |
592 | parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)') | 614 | parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)') |
593 | 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') | 615 | 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') |
616 | 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') | ||
594 | parser_create.set_defaults(func=create_recipe) | 617 | parser_create.set_defaults(func=create_recipe) |
595 | 618 | ||