summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-12-22 17:03:12 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-22 16:44:03 +0000
commit83707d1334fb094fd1877bcfd07a83866601048a (patch)
tree72428316f4f11ff96dcad569423892962addbee5 /scripts
parentaedfc5a5db1c4b2b80a36147c9a13b31764d91dd (diff)
downloadopenembedded-core-contrib-83707d1334fb094fd1877bcfd07a83866601048a.tar.gz
devtool: modify: default source tree path
As per the changes to "devtool add", make the source tree path optional and use the default path if none is specified. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/devtool4
-rw-r--r--scripts/lib/devtool/standard.py26
2 files changed, 19 insertions, 11 deletions
diff --git a/scripts/devtool b/scripts/devtool
index 93ba58e7a9..bda05e1c2f 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -152,6 +152,10 @@ def _create_workspace(workspacedir, config, basepath):
f.write('\nIf you no longer need to use devtool you can remove the path to this\n')
f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n')
f.write('layer, if you wish).\n')
+ f.write('\nNote that by default, if devtool fetches and unpacks source code, it\n')
+ f.write('will place it in a subdirectory of a "sources" subdirectory of the\n')
+ f.write('layer. If you prefer it to be elsewhere you can specify the source\n')
+ f.write('tree path on the command line.\n')
def _enable_workspace_layer(workspacedir, config, basepath):
"""Ensure the workspace layer is in bblayers.conf"""
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index e2496618a2..c710c16635 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -644,10 +644,15 @@ def modify(args, config, basepath, workspace):
raise DevtoolError("recipe %s is already in your workspace" %
args.recipename)
- if not args.extract and not os.path.isdir(args.srctree):
+ if args.srctree:
+ srctree = os.path.abspath(args.srctree)
+ else:
+ srctree = get_default_srctree(config, args.recipename)
+
+ if not args.extract and not os.path.isdir(srctree):
raise DevtoolError("directory %s does not exist or not a directory "
"(specify -x to extract source from recipe)" %
- args.srctree)
+ srctree)
if args.extract:
tinfoil = _prep_extract_operation(config, basepath, args.recipename)
if not tinfoil:
@@ -679,29 +684,28 @@ def modify(args, config, basepath, workspace):
initial_rev = None
commits = []
- srctree = os.path.abspath(args.srctree)
if args.extract:
- initial_rev = _extract_source(args.srctree, False, args.branch, False, rd)
+ initial_rev = _extract_source(srctree, False, args.branch, False, rd)
if not initial_rev:
return 1
logger.info('Source tree extracted to %s' % srctree)
# Get list of commits since this revision
- (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree)
+ (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree)
commits = stdout.split()
else:
- if os.path.exists(os.path.join(args.srctree, '.git')):
+ if os.path.exists(os.path.join(srctree, '.git')):
# Check if it's a tree previously extracted by us
try:
- (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=args.srctree)
+ (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree)
except bb.process.ExecutionError:
stdout = ''
for line in stdout.splitlines():
if line.startswith('*'):
- (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=args.srctree)
+ (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=srctree)
initial_rev = stdout.rstrip()
if not initial_rev:
# Otherwise, just grab the head revision
- (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree)
+ (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
initial_rev = stdout.rstrip()
# Check that recipe isn't using a shared workdir
@@ -1282,9 +1286,9 @@ def register_commands(subparsers, context):
parser_add.set_defaults(func=add)
parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe',
- description='Enables modifying the source for an existing recipe')
+ description='Enables modifying the source for an existing recipe. You can either provide your own pre-prepared source tree, or specify -x/--extract to extract the source being fetched by the recipe.')
parser_modify.add_argument('recipename', help='Name of existing recipe to edit (just name - no version, path or extension)')
- parser_modify.add_argument('srctree', help='Path to external source tree')
+ parser_modify.add_argument('srctree', nargs='?', help='Path to external source tree. If not specified, a subdirectory of %s will be used.' % defsrctree)
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')
group = parser_modify.add_mutually_exclusive_group()