mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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>
This commit is contained in:
parent
99e3872d89
commit
ec9016821d
|
@ -139,6 +139,8 @@ def add(args, config, basepath, workspace):
|
||||||
extracmdopts += ' -V %s' % args.version
|
extracmdopts += ' -V %s' % args.version
|
||||||
if args.binary:
|
if args.binary:
|
||||||
extracmdopts += ' -b'
|
extracmdopts += ' -b'
|
||||||
|
if args.also_native:
|
||||||
|
extracmdopts += ' --also-native'
|
||||||
|
|
||||||
tempdir = tempfile.mkdtemp(prefix='devtool')
|
tempdir = tempfile.mkdtemp(prefix='devtool')
|
||||||
try:
|
try:
|
||||||
|
@ -1307,6 +1309,7 @@ def register_commands(subparsers, context):
|
||||||
parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)')
|
parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)')
|
||||||
parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true")
|
parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a git repository', action="store_true")
|
||||||
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')
|
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')
|
||||||
|
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')
|
||||||
parser_add.set_defaults(func=add)
|
parser_add.set_defaults(func=add)
|
||||||
|
|
||||||
parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe',
|
parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe',
|
||||||
|
|
|
@ -252,8 +252,14 @@ def create_recipe(args):
|
||||||
if args.name:
|
if args.name:
|
||||||
pn = args.name
|
pn = args.name
|
||||||
if args.name.endswith('-native'):
|
if args.name.endswith('-native'):
|
||||||
|
if args.also_native:
|
||||||
|
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')
|
||||||
|
sys.exit(1)
|
||||||
classes.append('native')
|
classes.append('native')
|
||||||
elif args.name.startswith('nativesdk-'):
|
elif args.name.startswith('nativesdk-'):
|
||||||
|
if args.also_native:
|
||||||
|
logger.error('--also-native cannot be specified for a recipe named nativesdk-* (nativesdk-* denotes a recipe that is already only for nativesdk)')
|
||||||
|
sys.exit(1)
|
||||||
classes.append('nativesdk')
|
classes.append('nativesdk')
|
||||||
|
|
||||||
if pv and pv not in 'git svn hg'.split():
|
if pv and pv not in 'git svn hg'.split():
|
||||||
|
@ -393,6 +399,22 @@ def create_recipe(args):
|
||||||
line = re.sub('"[^+]*\+', '"%s+' % realpv, line)
|
line = re.sub('"[^+]*\+', '"%s+' % realpv, line)
|
||||||
lines_before.append(line)
|
lines_before.append(line)
|
||||||
|
|
||||||
|
if args.also_native:
|
||||||
|
lines = lines_after
|
||||||
|
lines_after = []
|
||||||
|
bbclassextend = None
|
||||||
|
for line in lines:
|
||||||
|
if line.startswith('BBCLASSEXTEND ='):
|
||||||
|
splitval = line.split('"')
|
||||||
|
if len(splitval) > 1:
|
||||||
|
bbclassextend = splitval[1].split()
|
||||||
|
if not 'native' in bbclassextend:
|
||||||
|
bbclassextend.insert(0, 'native')
|
||||||
|
line = 'BBCLASSEXTEND = "%s"' % ' '.join(bbclassextend)
|
||||||
|
lines_after.append(line)
|
||||||
|
if not bbclassextend:
|
||||||
|
lines_after.append('BBCLASSEXTEND = "native"')
|
||||||
|
|
||||||
outlines = []
|
outlines = []
|
||||||
outlines.extend(lines_before)
|
outlines.extend(lines_before)
|
||||||
if classes:
|
if classes:
|
||||||
|
@ -591,5 +613,6 @@ def register_commands(subparsers):
|
||||||
parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)')
|
parser_create.add_argument('-N', '--name', help='Name to use within recipe (PN)')
|
||||||
parser_create.add_argument('-V', '--version', help='Version to use within recipe (PV)')
|
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('-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.set_defaults(func=create_recipe)
|
parser_create.set_defaults(func=create_recipe)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user