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/+/1934330
Reviewed-by: Benoit L <lizeb@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718654}
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 6453874f..3291e2a 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -364,19 +364,20 @@
_CLOUD_STORAGE_BUCKET = None
_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.
Args:
repository_root: (str) Root of the target repository.
step_recorder: (StepRecorder) Step recorder, for logging.
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._step_recorder = step_recorder
self._branch = branch
- self._netrc = netrc
def CommitStashedFileHashes(self, files):
"""Commits unpatched and patched orderfiles hashes if changed.
@@ -634,8 +635,7 @@
assert issubclass(orderfile_updater_class, OrderfileUpdater)
self._orderfile_updater = orderfile_updater_class(self._clank_dir,
self._step_recorder,
- options.branch,
- options.netrc)
+ options.branch)
assert os.path.isdir(constants.DIR_SOURCE_ROOT), 'No src directory found'
symbol_extractor.SetArchitecture(options.arch)
@@ -1074,8 +1074,7 @@
if self._options.new_commit_flow:
self._orderfile_updater._GitStash()
else:
- if (self._options.buildbot and self._options.netrc
- and not self._step_recorder.ErrorRecorded()):
+ if (self._options.buildbot and not self._step_recorder.ErrorRecorded()):
unpatched_orderfile_filename = (
self._GetUnpatchedOrderfileFilename() if profile_uploaded else None)
orderfile_filename = (
@@ -1097,7 +1096,7 @@
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')
return False
self._orderfile_updater._CommitStashedFiles([
@@ -1135,11 +1134,10 @@
'--skip-patch', action='store_false', dest='patch', default=True,
help='Only generate the raw (unpatched) orderfile, don\'t patch it.')
parser.add_argument(
- '--netrc', action='store',
- help='A custom .netrc file to use for git checkin. Only used on bots.')
+ '--netrc', action='store', help='Obsolete. A custom .netrc file.')
parser.add_argument(
'--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.')
# Obsolete (Autoninja is now used, and this argument is ignored).
parser.add_argument(