diff options
author | Cassidy Burden <cburden@google.com> | 2016-08-05 11:00:29 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-05 13:22:03 -0700 |
commit | 3892aa1c459f07a5355a8aa94c7ab3c5f6e5cf39 (patch) | |
tree | d6e9ab1adc1871204de2fa6edaffe590a78b8a98 /binary_search_tool | |
parent | e1a28bd82a8718b67a370433dd41932c567f6899 (diff) | |
download | toolchain-utils-3892aa1c459f07a5355a8aa94c7ab3c5f6e5cf39.tar.gz |
binary search tool: Show how to reconstruct bisection env
When bisect.py finishes, give users instructions on how to reconstruct
bisection environment. This essentially gives the same setup.sh call
that bisect.py uses.
Change-Id: I060a4f3397e7d83d83321d25e751d6c47951436b
Reviewed-on: https://chrome-internal-review.googlesource.com/273407
Commit-Ready: Cassidy Burden <cburden@google.com>
Tested-by: Cassidy Burden <cburden@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool')
-rwxr-xr-x | binary_search_tool/bisect.py | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/binary_search_tool/bisect.py b/binary_search_tool/bisect.py index 6315c81c..dbe95d88 100755 --- a/binary_search_tool/bisect.py +++ b/binary_search_tool/bisect.py @@ -142,12 +142,13 @@ class BisectPackage(Bisector): 'prune': True, 'file_args': True } + self.setup_cmd = ('%s %s %s' % (self.cros_pkg_setup, self.options.board, + self.options.remote)) self.ArgOverride(self.default_kwargs, self.overrides) def PreRun(self): - cmd = ('%s %s %s' % - (self.cros_pkg_setup, self.options.board, self.options.remote)) - ret, _, _ = self.ce.RunCommandWExceptionCleanup(cmd, print_to_console=True) + ret, _, _ = self.ce.RunCommandWExceptionCleanup( + self.setup_cmd, print_to_console=True) if ret: self.logger.LogError('Package bisector setup failed w/ error %d' % ret) return 1 @@ -162,6 +163,10 @@ class BisectPackage(Bisector): if ret: self.logger.LogError('Package bisector cleanup failed w/ error %d' % ret) return 1 + + self.logger.LogOutput(('Cleanup successful! To restore the bisection ' + 'environment run the following:\n' + ' cd %s; %s') % (os.getcwd(), self.setup_cmd)) return 0 @@ -188,13 +193,15 @@ class BisectObject(Bisector): if options.dir: os.environ['BISECT_DIR'] = options.dir self.options.dir = os.environ.get('BISECT_DIR', '/tmp/sysroot_bisect') + self.setup_cmd = ('%s %s %s %s' % (self.sysroot_wrapper_setup, + self.options.board, self.options.remote, + self.options.package)) self.ArgOverride(self.default_kwargs, overrides) def PreRun(self): - cmd = ('%s %s %s %s' % (self.sysroot_wrapper_setup, self.options.board, - self.options.remote, self.options.package)) - ret, _, _ = self.ce.RunCommandWExceptionCleanup(cmd, print_to_console=True) + ret, _, _ = self.ce.RunCommandWExceptionCleanup( + self.setup_cmd, print_to_console=True) if ret: self.logger.LogError('Object bisector setup failed w/ error %d' % ret) return 1 @@ -211,6 +218,9 @@ class BisectObject(Bisector): if ret: self.logger.LogError('Object bisector cleanup failed w/ error %d' % ret) return 1 + self.logger.LogOutput(('Cleanup successful! To restore the bisection ' + 'environment run the following:\n' + ' cd %s; %s') % (os.getcwd(), self.setup_cmd)) return 0 @@ -239,17 +249,19 @@ class BisectAndroid(Bisector): os.environ['BISECT_DIR'] = options.dir self.options.dir = os.environ.get('BISECT_DIR', self.default_dir) - self.ArgOverride(self.default_kwargs, overrides) - - def PreRun(self): num_jobs = "NUM_JOBS='%s'" % self.options.num_jobs device_id = "" if self.options.device_id: device_id = "ANDROID_SERIAL='%s'" % self.options.device_id - cmd = ('%s %s %s %s' % (num_jobs, device_id, self.android_setup, - self.options.android_src)) - ret, _, _ = self.ce.RunCommandWExceptionCleanup(cmd, print_to_console=True) + self.setup_cmd = ('%s %s %s %s' % (num_jobs, device_id, self.android_setup, + self.options.android_src)) + + self.ArgOverride(self.default_kwargs, overrides) + + def PreRun(self): + ret, _, _ = self.ce.RunCommandWExceptionCleanup( + self.setup_cmd, print_to_console=True) if ret: self.logger.LogError('Android bisector setup failed w/ error %d' % ret) return 1 @@ -266,6 +278,9 @@ class BisectAndroid(Bisector): if ret: self.logger.LogError('Android bisector cleanup failed w/ error %d' % ret) return 1 + self.logger.LogOutput(('Cleanup successful! To restore the bisection ' + 'environment run the following:\n' + ' cd %s; %s') % (os.getcwd(), self.setup_cmd)) return 0 |