Commit 376425bd authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Android: Fix fetch_all.py's CIPD commands

Print CIPD commands that avoid creating new ones if existing CIPD
packages are found with the same tags, display those with
`cipd describe` instead.

Bug: 867454
Change-Id: I9cccdcf55d5ddb02a98f4dd8d530d9240618b817
Reviewed-on: https://chromium-review.googlesource.com/1155480Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579126}
parent cc1732e0
...@@ -311,9 +311,13 @@ def GenerateCipdUploadCommand(cipd_pkg_info): ...@@ -311,9 +311,13 @@ def GenerateCipdUploadCommand(cipd_pkg_info):
Returns: Returns:
A string holding a shell command to upload the package through cipd. A string holding a shell command to upload the package through cipd.
""" """
pkg_path, _, pkg_tag = cipd_pkg_info pkg_path, pkg_name, pkg_tag = cipd_pkg_info
return '(cd %s; cipd create --pkg-def cipd.yaml -tag %s)' % ( return ('(cd {0}; '
pkg_path, pkg_tag) # Need to skip create step if an instance already exists with the
# same package name and version tag (thus the use of ||).
'cipd describe {1} -version {2} || '
'cipd create --pkg-def cipd.yaml -tag {2})').format(
pkg_path, pkg_name, pkg_tag)
def main(): def main():
...@@ -497,6 +501,7 @@ def main(): ...@@ -497,6 +501,7 @@ def main():
if cipd_packages_to_upload: if cipd_packages_to_upload:
print 'Run the following to upload new and updated CIPD packages:' print 'Run the following to upload new and updated CIPD packages:'
print 'Note: Duplicate instances with the same tag will break the build.'
print '------------------------ cut here -----------------------------' print '------------------------ cut here -----------------------------'
print '\n'.join(cipd_commands) print '\n'.join(cipd_commands)
print '------------------------ cut here -----------------------------' print '------------------------ cut here -----------------------------'
......
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