Commit 7ff04126 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

orderfile: Prepare for eliminating netrc

Pushing to internal repo does not require a netrc any more (uses a
more fancy auth with role accounts and ACLs). Hence removing the
support code for it.

A downstream test instantiates the OrderfileUpdater. Make the
constructor argument optional to avoid changing downstream code
simultaneously.

Bug: 1021528
Change-Id: Ie902bdd1d7272f7d884f6ce2e99e9983a1aa5166
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934330Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718654}
parent 2541ee73
...@@ -364,19 +364,20 @@ class OrderfileUpdater(object): ...@@ -364,19 +364,20 @@ class OrderfileUpdater(object):
_CLOUD_STORAGE_BUCKET = None _CLOUD_STORAGE_BUCKET = None
_UPLOAD_TO_CLOUD_COMMAND = 'upload_to_google_storage.py' _UPLOAD_TO_CLOUD_COMMAND = 'upload_to_google_storage.py'
def __init__(self, repository_root, step_recorder, branch, netrc): def __init__(self, repository_root, step_recorder, branch, netrc=None):
"""Constructor. """Constructor.
Args: Args:
repository_root: (str) Root of the target repository. repository_root: (str) Root of the target repository.
step_recorder: (StepRecorder) Step recorder, for logging. step_recorder: (StepRecorder) Step recorder, for logging.
branch: (str) Branch to commit to. branch: (str) Branch to commit to.
netrc: (str) Path to the .netrc file to use. netrc: (str) Obsolete. Specified by code in internal repo. TODO(pasko):
remove.
""" """
# pylint: disable=unused-argument
self._repository_root = repository_root self._repository_root = repository_root
self._step_recorder = step_recorder self._step_recorder = step_recorder
self._branch = branch self._branch = branch
self._netrc = netrc
def CommitStashedFileHashes(self, files): def CommitStashedFileHashes(self, files):
"""Commits unpatched and patched orderfiles hashes if changed. """Commits unpatched and patched orderfiles hashes if changed.
...@@ -634,8 +635,7 @@ class OrderfileGenerator(object): ...@@ -634,8 +635,7 @@ class OrderfileGenerator(object):
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,
options.branch, options.branch)
options.netrc)
assert os.path.isdir(constants.DIR_SOURCE_ROOT), 'No src directory found' assert os.path.isdir(constants.DIR_SOURCE_ROOT), 'No src directory found'
symbol_extractor.SetArchitecture(options.arch) symbol_extractor.SetArchitecture(options.arch)
...@@ -1074,8 +1074,7 @@ class OrderfileGenerator(object): ...@@ -1074,8 +1074,7 @@ class OrderfileGenerator(object):
if self._options.new_commit_flow: if self._options.new_commit_flow:
self._orderfile_updater._GitStash() self._orderfile_updater._GitStash()
else: else:
if (self._options.buildbot and self._options.netrc if (self._options.buildbot and not self._step_recorder.ErrorRecorded()):
and not self._step_recorder.ErrorRecorded()):
unpatched_orderfile_filename = ( unpatched_orderfile_filename = (
self._GetUnpatchedOrderfileFilename() if profile_uploaded else None) self._GetUnpatchedOrderfileFilename() if profile_uploaded else None)
orderfile_filename = ( orderfile_filename = (
...@@ -1097,7 +1096,7 @@ class OrderfileGenerator(object): ...@@ -1097,7 +1096,7 @@ class OrderfileGenerator(object):
Returns: true on success. Returns: true on success.
""" """
if not (self._options.buildbot and self._options.netrc): if not self._options.buildbot:
logging.error('Trying to commit when not running on the buildbot') logging.error('Trying to commit when not running on the buildbot')
return False return False
self._orderfile_updater._CommitStashedFiles([ self._orderfile_updater._CommitStashedFiles([
...@@ -1135,11 +1134,10 @@ def CreateArgumentParser(): ...@@ -1135,11 +1134,10 @@ def CreateArgumentParser():
'--skip-patch', action='store_false', dest='patch', default=True, '--skip-patch', action='store_false', dest='patch', default=True,
help='Only generate the raw (unpatched) orderfile, don\'t patch it.') help='Only generate the raw (unpatched) orderfile, don\'t patch it.')
parser.add_argument( parser.add_argument(
'--netrc', action='store', '--netrc', action='store', help='Obsolete. A custom .netrc file.')
help='A custom .netrc file to use for git checkin. Only used on bots.')
parser.add_argument( parser.add_argument(
'--branch', action='store', default='master', '--branch', action='store', default='master',
help='When running on buildbot with a netrc, the branch orderfile ' help='When running on buildbot, the branch orderfile '
'hashes get checked into.') 'hashes get checked into.')
# Obsolete (Autoninja is now used, and this argument is ignored). # Obsolete (Autoninja is now used, and this argument is ignored).
parser.add_argument( parser.add_argument(
......
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