devtool: modify: use B=S if that is the default for the recipe
PATCH 1/2 devtool: modify: use B=S if that is the default for the recipe
Makes the build succeed for packages which do not support separate build directory, e.g. zlib. The same outcome could be achieved with the --same-dir option, but, it's generally hard to tell if a random package would need that option. The negative side effect of this patch is that dev srctree (of some packages that build fine without this modification) gets dirtied by build artefacts.
--- scripts/lib/devtool/standard.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
scripts/lib/devtool/standard.py +12 -5
@@ -391,12 +391,19 @@ def modify(args, config, basepath, workspace): f.write('inherit externalsrc\n') f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) - if args.same_dir or bb.data.inherits_class('autotools-brokensep', rd): - if args.same_dir: - logger.info('using source tree as build directory since --same-dir specified') - else: - logger.info('using source tree as build directory since original recipe inherits autotools-brokensep') + + b_is_s = True + if args.same_dir: + logger.info('using source tree as build directory since --same-dir specified') + elif bb.data.inherits_class('autotools-brokensep', rd): + logger.info('using source tree as build directory since original recipe inherits autotools-brokensep') + elif rd.getVar('B', True) == s: + logger.info('using source tree as build directory since that is the default for this recipe') + else: + b_is_s = False + if b_is_s: f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) + if initial_rev: f.write('\n# initial_rev: %s\n' % initial_rev) for commit in commits:
Signature · 1 line
2.1.4
PATCH 2/2 devtool: modify: implement --no-same-dir
This option can be used to have a separate build directory, in order to keep the srctree directory clean for packages that do not need to be built in the source directory.
--- scripts/lib/devtool/standard.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
scripts/lib/devtool/standard.py +7 -2
@@ -393,7 +393,10 @@ def modify(args, config, basepath, workspace): f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) b_is_s = True - if args.same_dir: + if args.no_same_dir: + logger.info('using separate build directory since --no-same-dir specified') + b_is_s = False + elif args.same_dir: logger.info('using source tree as build directory since --same-dir specified') elif bb.data.inherits_class('autotools-brokensep', rd): logger.info('using source tree as build directory since original recipe inherits autotools-brokensep')
@@ -670,7 +673,9 @@ def register_commands(subparsers, context): parser_modify.add_argument('srctree', help='Path to external source tree') parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend') parser_modify.add_argument('--extract', '-x', action="store_true", help='Extract source as well') - parser_modify.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + group = parser_modify.add_mutually_exclusive_group() + group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (only when using -x)') parser_modify.set_defaults(func=modify)
Signature · 1 line
2.1.4
Quoted 40 lines · On Tuesday 21 April 2015 17:52:19 Markus Lehtonen wrote:
Makes the build succeed for packages which do not support separate build directory, e.g. zlib. The same outcome could be achieved with the --same-dir option, but, it's generally hard to tell if a random package would need that option. The negative side effect of this patch is that dev srctree (of some packages that build fine without this modification) gets dirtied by build artefacts.
Signed-off-by Markus Lehtonen <[email protected]>--- scripts/lib/devtool/standard.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/scripts/lib/devtool/standard.pyindex 96e3bdb..1c1bce8 100644scripts/lib/devtool/standard.py +0
-0@@ -391,12 +391,19 @@ def modify(args, config, basepath, workspace): f.write('inherit externalsrc\n') f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n')
f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree))- if args.same_dir orbb.data.inherits_class('autotools-brokensep', rd): -
if args.same_dir:scripts/lib/devtool/standard.py +0
-3- logger.info('using source tree as build directory since --same-dir specified') - else: - logger.info('using source tree as build directory sinceoriginal recipe inherits autotools-brokensep') +
scripts/lib/devtool/standard.py +3
-1+ b_is_s = True + if args.same_dir: + logger.info('using source tree as build directory since --same-dir specified') + elif
bb.data.inherits_class('autotools-brokensep', rd):
+ logger.info('using source tree as build directory since
original recipe inherits autotools-brokensep') + elif rd.getVar('B',
True) == s:
+ logger.info('using source tree as build directory since that is
the default for this recipe') + else:scripts/lib/devtool/standard.py +2
-0+ b_is_s = False + if b_is_s: f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename,
Quoted 4 lines
srctree)) +
ifinitial_rev:
f.write('\n# initial_rev: %s\n' % initial_rev)for commit in commits:
Both this and 2/2 look good to me.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre