Commit d80bfad9 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

Orderfile: run _GitStash only on bots, simplify --public

When running on buildbot, we always use the internal version. The git
stash/unstash/commit/push should be avoided when running locally
(options.buildbot=False). In the public repository, the OrderfileUpdater
should be able to upload files, it was useful just once.

With this, the OrderfileNoopUpdater looks unnecessary, since we replace
OrderfileUpdater in the internal repo anyway, so remove it.

Otherwise the split of functionality between the public and the internal
OrderfileUpdater is accidental. Not revisiting it here.

Bug: None
Change-Id: Icd0fc9ed69d0def8e1fa9cfd1be05083f7c9cbf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403469Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805911}
parent cc065a14
...@@ -428,10 +428,6 @@ class OrderfileUpdater(object): ...@@ -428,10 +428,6 @@ class OrderfileUpdater(object):
with open(abs_hash_filename, 'r') as f: with open(abs_hash_filename, 'r') as f:
return (rel_hash_filename, f.read()) return (rel_hash_filename, f.read())
def _CommitFiles(self, files_to_commit, commit_message_lines):
"""Commits a list of files, with a given message."""
raise NotImplementedError
def _GitStash(self): def _GitStash(self):
"""Git stash the current clank tree. """Git stash the current clank tree.
...@@ -458,19 +454,6 @@ class OrderfileUpdater(object): ...@@ -458,19 +454,6 @@ class OrderfileUpdater(object):
raise NotImplementedError raise NotImplementedError
class OrderfileNoopUpdater(OrderfileUpdater):
def CommitFileHashes(self, unpatched_orderfile_filename, orderfile_filename):
# pylint: disable=unused-argument
return
def UploadToCloudStorage(self, filename, use_debug_location):
# pylint: disable=unused-argument
return
def _CommitFiles(self, files_to_commit, commit_message_lines):
raise NotImplementedError
class OrderfileGenerator(object): class OrderfileGenerator(object):
"""A utility for generating a new orderfile for Clank. """A utility for generating a new orderfile for Clank.
...@@ -594,10 +577,7 @@ class OrderfileGenerator(object): ...@@ -594,10 +577,7 @@ class OrderfileGenerator(object):
self._step_recorder = StepRecorder(options.buildbot) self._step_recorder = StepRecorder(options.buildbot)
self._compiler = None self._compiler = None
if orderfile_updater_class is None: if orderfile_updater_class is None:
if options.public: orderfile_updater_class = OrderfileUpdater
orderfile_updater_class = OrderfileNoopUpdater
else:
orderfile_updater_class = OrderfileUpdater
assert issubclass(orderfile_updater_class, OrderfileUpdater) assert issubclass(orderfile_updater_class, OrderfileUpdater)
self._orderfile_updater = orderfile_updater_class(self._clank_dir, self._orderfile_updater = orderfile_updater_class(self._clank_dir,
self._step_recorder) self._step_recorder)
...@@ -1031,7 +1011,8 @@ class OrderfileGenerator(object): ...@@ -1031,7 +1011,8 @@ class OrderfileGenerator(object):
self._output_data['no_orderfile_benchmark_results'] = self.RunBenchmark( self._output_data['no_orderfile_benchmark_results'] = self.RunBenchmark(
self._no_orderfile_out_dir, no_orderfile=True) self._no_orderfile_out_dir, no_orderfile=True)
self._orderfile_updater._GitStash() if self._options.buildbot:
self._orderfile_updater._GitStash()
self._step_recorder.EndStep() self._step_recorder.EndStep()
return not self._step_recorder.ErrorRecorded() return not self._step_recorder.ErrorRecorded()
...@@ -1089,8 +1070,10 @@ def CreateArgumentParser(): ...@@ -1089,8 +1070,10 @@ def CreateArgumentParser():
'--use-goma', action='store_true', help='Enable GOMA.', default=False) '--use-goma', action='store_true', help='Enable GOMA.', default=False)
parser.add_argument('--adb-path', help='Path to the adb binary.') parser.add_argument('--adb-path', help='Path to the adb binary.')
parser.add_argument('--public', action='store_true', parser.add_argument('--public',
help='Required if your checkout is non-internal.', action='store_true',
help='Build non-internal APK and change the orderfile '
'location. Required if your checkout is non-internal.',
default=False) default=False)
parser.add_argument('--nosystem-health-orderfile', action='store_false', parser.add_argument('--nosystem-health-orderfile', action='store_false',
dest='system_health_orderfile', default=True, dest='system_health_orderfile', default=True,
...@@ -1146,9 +1129,6 @@ def CreateOrderfile(options, orderfile_updater_class=None): ...@@ -1146,9 +1129,6 @@ def CreateOrderfile(options, orderfile_updater_class=None):
Args: Args:
options: As returned from optparse.OptionParser.parse_args() options: As returned from optparse.OptionParser.parse_args()
orderfile_updater_class: (OrderfileUpdater) subclass of OrderfileUpdater. orderfile_updater_class: (OrderfileUpdater) subclass of OrderfileUpdater.
Use to explicitly set an OrderfileUpdater class,
the defaults are OrderfileUpdater, or
OrderfileNoopUpdater if --public is set.
Returns: Returns:
True iff success. True iff success.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment