summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorDan Dedrick <dan.dedrick@gmail.com>2019-01-21 15:15:27 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-22 14:35:58 +0000
commita563459ea4027c41717ac00ba28fd924bc17fac5 (patch)
tree928b357772a7a27e887baa6d34be2fc3bb0df2e0 /scripts/lib
parent84be37241c57207cbceabc9f77746d4c96096e83 (diff)
downloadpoky-a563459ea4027c41717ac00ba28fd924bc17fac5.tar.gz
devtool: improve git repo checks before check_commits logic
The check_commits logic assumes that both devtool-base and args.branch exist in the git repo that it is operating on. In order to prevent errors at that point it's best to first ensure that both of these refs actually exist. If they don't both exist then the check_commits logic should just be skipped, as it would be if the repo wasn't originally checked out by devtool. Previously if a user removed the args.branch branch from their devtool cloned repo this code would crash on adding the repo with -n. The crash would look like this: Traceback (most recent call last): File "/home/ddedrick/src/poky/scripts/devtool", line 344, in <module> ret = main() File "/home/ddedrick/src/poky/scripts/devtool", line 331, in main ret = args.func(args, config, basepath, workspace) File "/home/ddedrick/src/poky/scripts/lib/devtool/standard.py", line 812, in modify (stdout, _) = bb.process.run('git log devtool-base..%s' % branch, cwd=srctree) File "/home/ddedrick/src/poky/bitbake/lib/bb/process.py", line 178, in run raise ExecutionError(cmd, pipe.returncode, stdout, stderr) bb.process.ExecutionError: Execution of 'git log devtool-base..devtool' failed with exit code 128: fatal: ambiguous argument 'devtool-base..devtool': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' (From OE-Core rev: f13a3490fdb404bbd4c77e45b83540d6deec1358) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/standard.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index a45ad36812..b7d4d47dfc 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -774,9 +774,13 @@ def modify(args, config, basepath, workspace):
774 check_commits = True 774 check_commits = True
775 else: 775 else:
776 if os.path.exists(os.path.join(srctree, '.git')): 776 if os.path.exists(os.path.join(srctree, '.git')):
777 # Check if it's a tree previously extracted by us 777 # Check if it's a tree previously extracted by us. This is done
778 # by ensuring that devtool-base and args.branch (devtool) exist.
779 # The check_commits logic will cause an exception if either one
780 # of these doesn't exist
778 try: 781 try:
779 (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree) 782 (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree)
783 bb.process.run('git rev-parse %s' % args.branch, cwd=srctree)
780 except bb.process.ExecutionError: 784 except bb.process.ExecutionError:
781 stdout = '' 785 stdout = ''
782 if stdout: 786 if stdout: