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):
with open(abs_hash_filename, 'r') as f:
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):
"""Git stash the current clank tree.
......@@ -458,19 +454,6 @@ class OrderfileUpdater(object):
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):
"""A utility for generating a new orderfile for Clank.
......@@ -594,9 +577,6 @@ class OrderfileGenerator(object):
self._step_recorder = StepRecorder(options.buildbot)
self._compiler = None
if orderfile_updater_class is None:
if options.public:
orderfile_updater_class = OrderfileNoopUpdater
else:
orderfile_updater_class = OrderfileUpdater
assert issubclass(orderfile_updater_class, OrderfileUpdater)
self._orderfile_updater = orderfile_updater_class(self._clank_dir,
......@@ -1031,6 +1011,7 @@ class OrderfileGenerator(object):
self._output_data['no_orderfile_benchmark_results'] = self.RunBenchmark(
self._no_orderfile_out_dir, no_orderfile=True)
if self._options.buildbot:
self._orderfile_updater._GitStash()
self._step_recorder.EndStep()
return not self._step_recorder.ErrorRecorded()
......@@ -1089,8 +1070,10 @@ def CreateArgumentParser():
'--use-goma', action='store_true', help='Enable GOMA.', default=False)
parser.add_argument('--adb-path', help='Path to the adb binary.')
parser.add_argument('--public', action='store_true',
help='Required if your checkout is non-internal.',
parser.add_argument('--public',
action='store_true',
help='Build non-internal APK and change the orderfile '
'location. Required if your checkout is non-internal.',
default=False)
parser.add_argument('--nosystem-health-orderfile', action='store_false',
dest='system_health_orderfile', default=True,
......@@ -1146,9 +1129,6 @@ def CreateOrderfile(options, orderfile_updater_class=None):
Args:
options: As returned from optparse.OptionParser.parse_args()
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:
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