| Index: prebuilt.py
|
| diff --git a/prebuilt.py b/prebuilt.py
|
| index ee9ecf1887d3e416f6744b5c995d6eace7f39d56..f9de7980b52a4578fa5d203f178c4315187375cc 100755
|
| --- a/prebuilt.py
|
| +++ b/prebuilt.py
|
| @@ -117,7 +117,7 @@ def UpdateLocalFile(filename, value, key='PORTAGE_BINHOST'):
|
| file_fh.close()
|
| # write out new file
|
| new_file_fh = open(filename, 'w')
|
| - new_file_fh.write('\n'.join(file_lines))
|
| + new_file_fh.write('\n'.join(file_lines) + '\n')
|
| new_file_fh.close()
|
|
|
|
|
| @@ -143,7 +143,7 @@ def RevGitPushWithRetry(retries=5):
|
| raise GitPushFailed('Failed to push change after %s retries' % retries)
|
|
|
|
|
| -def RevGitFile(filename, value, retries=5):
|
| +def RevGitFile(filename, value, retries=5, key='PORTAGE_BINHOST'):
|
| """Update and push the git file.
|
|
|
| Args:
|
| @@ -151,6 +151,8 @@ def RevGitFile(filename, value, retries=5):
|
| value: string representing the version of the prebuilt that has been
|
| uploaded.
|
| retries: The number of times to retry before giving up, default: 5
|
| + key: The variable key to update in the git file.
|
| + (Default: PORTAGE_BINHOST)
|
| """
|
| prebuilt_branch = 'prebuilt_branch'
|
| old_cwd = os.getcwd()
|
| @@ -162,10 +164,10 @@ def RevGitFile(filename, value, retries=5):
|
| 'git config url.ssh://git@gitrw.chromium.org:9222.pushinsteadof '
|
| 'http://git.chromium.org/git')
|
| cros_build_lib.RunCommand(git_ssh_config_cmd, shell=True)
|
| - description = 'Update PORTAGE_BINHOST="%s" in %s' % (value, filename)
|
| + description = 'Update %s="%s" in %s' % (key, value, filename)
|
| print description
|
| try:
|
| - UpdateLocalFile(filename, value)
|
| + UpdateLocalFile(filename, value, key)
|
| cros_build_lib.RunCommand('git config push.default tracking', shell=True)
|
| cros_build_lib.RunCommand('git commit -am "%s"' % description, shell=True)
|
| RevGitPushWithRetry(retries)
|
| @@ -406,7 +408,8 @@ def DetermineMakeConfFile(target):
|
|
|
|
|
| def UploadPrebuilt(build_path, upload_location, version, binhost_base_url,
|
| - board=None, git_sync=False, git_sync_retries=5):
|
| + board=None, git_sync=False, git_sync_retries=5,
|
| + key='PORTAGE_BINHOST'):
|
| """Upload Host prebuilt files to Google Storage space.
|
|
|
| Args:
|
| @@ -415,10 +418,11 @@ def UploadPrebuilt(build_path, upload_location, version, binhost_base_url,
|
| board: The board to upload to Google Storage, if this is None upload
|
| host packages.
|
| git_sync: If set, update make.conf of target to reference the latest
|
| - prebuilt packages genereated here.
|
| + prebuilt packages generated here.
|
| git_sync_retries: How many times to retry pushing when updating git files.
|
| This helps avoid failures when multiple bots are modifying the same Repo.
|
| default: 5
|
| + key: The variable key to update in the git file. (Default: PORTAGE_BINHOST)
|
| """
|
|
|
| if not board:
|
| @@ -454,7 +458,7 @@ def UploadPrebuilt(build_path, upload_location, version, binhost_base_url,
|
|
|
| if git_sync:
|
| url_value = '%s/%s/' % (binhost_base_url, url_suffix)
|
| - RevGitFile(git_file, url_value, retries=git_sync_retries)
|
| + RevGitFile(git_file, url_value, retries=git_sync_retries, key=key)
|
|
|
|
|
| def usage(parser, msg):
|
| @@ -488,6 +492,9 @@ def main():
|
| parser.add_option('-f', '--filters', dest='filters', action='store_true',
|
| default=False,
|
| help='Turn on filtering of private ebuild packages')
|
| + parser.add_option('-k', '--key', dest='key',
|
| + default='PORTAGE_BINHOST',
|
| + help='Key to update in make.conf')
|
|
|
| options, args = parser.parse_args()
|
| # Setup boto environment for gsutil to use
|
| @@ -511,12 +518,13 @@ def main():
|
|
|
| if options.sync_host:
|
| UploadPrebuilt(options.build_path, options.upload, version,
|
| - options.binhost_base_url, git_sync=options.git_sync)
|
| + options.binhost_base_url, git_sync=options.git_sync,
|
| + key=options.key)
|
|
|
| if options.board:
|
| UploadPrebuilt(options.build_path, options.upload, version,
|
| options.binhost_base_url, board=options.board,
|
| - git_sync=options.git_sync)
|
| + git_sync=options.git_sync, key=options.key)
|
|
|
|
|
| if __name__ == '__main__':
|
|
|