summaryrefslogtreecommitdiffstats
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-28 09:25:14 +0000
commite11673960f039e06d03cd795c160d19d7996b91f (patch)
tree8f0870b70376833aba7f8f3c502733cb42166977
parent110f4337f2bd12ecbfd91b222af1baad3a14788a (diff)
downloadpoky-e11673960f039e06d03cd795c160d19d7996b91f.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. (From OE-Core rev: 83707d1334fb094fd1877bcfd07a83866601048a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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):
152 f.write('\nIf you no longer need to use devtool you can remove the path to this\n') 152 f.write('\nIf you no longer need to use devtool you can remove the path to this\n')
153 f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n') 153 f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n')
154 f.write('layer, if you wish).\n') 154 f.write('layer, if you wish).\n')
155 f.write('\nNote that by default, if devtool fetches and unpacks source code, it\n')
156 f.write('will place it in a subdirectory of a "sources" subdirectory of the\n')
157 f.write('layer. If you prefer it to be elsewhere you can specify the source\n')
158 f.write('tree path on the command line.\n')
155 159
156def _enable_workspace_layer(workspacedir, config, basepath): 160def _enable_workspace_layer(workspacedir, config, basepath):
157 """Ensure the workspace layer is in bblayers.conf""" 161 """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):
644 raise DevtoolError("recipe %s is already in your workspace" % 644 raise DevtoolError("recipe %s is already in your workspace" %
645 args.recipename) 645 args.recipename)
646 646
647 if not args.extract and not os.path.isdir(args.srctree): 647 if args.srctree:
648 srctree = os.path.abspath(args.srctree)
649 else:
650 srctree = get_default_srctree(config, args.recipename)
651
652 if not args.extract and not os.path.isdir(srctree):
648 raise DevtoolError("directory %s does not exist or not a directory " 653 raise DevtoolError("directory %s does not exist or not a directory "
649 "(specify -x to extract source from recipe)" % 654 "(specify -x to extract source from recipe)" %
650 args.srctree) 655 srctree)
651 if args.extract: 656 if args.extract:
652 tinfoil = _prep_extract_operation(config, basepath, args.recipename) 657 tinfoil = _prep_extract_operation(config, basepath, args.recipename)
653 if not tinfoil: 658 if not tinfoil:
@@ -679,29 +684,28 @@ def modify(args, config, basepath, workspace):
679 684
680 initial_rev = None 685 initial_rev = None
681 commits = [] 686 commits = []
682 srctree = os.path.abspath(args.srctree)
683 if args.extract: 687 if args.extract:
684 initial_rev = _extract_source(args.srctree, False, args.branch, False, rd) 688 initial_rev = _extract_source(srctree, False, args.branch, False, rd)
685 if not initial_rev: 689 if not initial_rev:
686 return 1 690 return 1
687 logger.info('Source tree extracted to %s' % srctree) 691 logger.info('Source tree extracted to %s' % srctree)
688 # Get list of commits since this revision 692 # Get list of commits since this revision
689 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree) 693 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree)
690 commits = stdout.split() 694 commits = stdout.split()
691 else: 695 else:
692 if os.path.exists(os.path.join(args.srctree, '.git')): 696 if os.path.exists(os.path.join(srctree, '.git')):
693 # Check if it's a tree previously extracted by us 697 # Check if it's a tree previously extracted by us
694 try: 698 try:
695 (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=args.srctree) 699 (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree)
696 except bb.process.ExecutionError: 700 except bb.process.ExecutionError:
697 stdout = '' 701 stdout = ''
698 for line in stdout.splitlines(): 702 for line in stdout.splitlines():
699 if line.startswith('*'): 703 if line.startswith('*'):
700 (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=args.srctree) 704 (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=srctree)
701 initial_rev = stdout.rstrip() 705 initial_rev = stdout.rstrip()
702 if not initial_rev: 706 if not initial_rev:
703 # Otherwise, just grab the head revision 707 # Otherwise, just grab the head revision
704 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree) 708 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
705 initial_rev = stdout.rstrip() 709 initial_rev = stdout.rstrip()
706 710
707 # Check that recipe isn't using a shared workdir 711 # Check that recipe isn't using a shared workdir
@@ -1282,9 +1286,9 @@ def register_commands(subparsers, context):
1282 parser_add.set_defaults(func=add) 1286 parser_add.set_defaults(func=add)
1283 1287
1284 parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', 1288 parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe',
1285 description='Enables modifying the source for an existing recipe') 1289 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.')
1286 parser_modify.add_argument('recipename', help='Name of existing recipe to edit (just name - no version, path or extension)') 1290 parser_modify.add_argument('recipename', help='Name of existing recipe to edit (just name - no version, path or extension)')
1287 parser_modify.add_argument('srctree', help='Path to external source tree') 1291 parser_modify.add_argument('srctree', nargs='?', help='Path to external source tree. If not specified, a subdirectory of %s will be used.' % defsrctree)
1288 parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend') 1292 parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend')
1289 parser_modify.add_argument('--extract', '-x', action="store_true", help='Extract source as well') 1293 parser_modify.add_argument('--extract', '-x', action="store_true", help='Extract source as well')
1290 group = parser_modify.add_mutually_exclusive_group() 1294 group = parser_modify.add_mutually_exclusive_group()