Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: editor/build/promote.py

Issue 38943004: Recursive copy with gsutil does only work work if more then one object is inside the source directo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/bots/bot_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/build/promote.py
diff --git a/editor/build/promote.py b/editor/build/promote.py
index 72121ce7064303d60f3eb0a9d1180da27ff47fd8..d6951da2de8a0deb854a32e7e18c162b8c3bbcaa 100644
--- a/editor/build/promote.py
+++ b/editor/build/promote.py
@@ -119,6 +119,22 @@ def main():
print 'You must specify a --revision to specify which revision to promote'
parser.print_help()
sys.exit(3)
+
+ # Make sure revision is a valid integer
+ try:
+ _ = int(options.revision)
+ except:
+ print 'You must supply a valid integer argument to --revision to promote'
+ parser.print_help()
+ sys.exit(3)
+
+ # Make sure options.channel is a valid channel if given
+ if options.channel:
+ if options.channel not in bot_utils.Channel.ALL_CHANNELS:
+ print 'You must supply a valid channel to --channel to promote'
+ parser.print_help()
+ sys.exit(3)
+
if not (options.continuous or options.integration or
options.testing or options.trunk or options.internal or
options.channel):
@@ -289,6 +305,18 @@ def _PromoteDartArchiveBuild(channel, revision):
release_namer = bot_utils.GCSNamer(channel, bot_utils.ReleaseType.RELEASE)
def promote(to_revision):
+ def safety_check_on_gs_path(gs_path, revision, channel):
+ if not ((revision == 'latest' or int(revision) > 0)
+ and len(channel) > 0
+ and ('%s' % revision) in gs_path
+ and channel in gs_path):
+ raise Exception(
+ "InternalError: Sanity check failed on GS URI: %s" % gs_path)
+
+ def remove_gs_directory(gs_path):
+ safety_check_on_gs_path(gs_path, to_revision, channel)
+ _Gsutil(['-m', 'rm', '-R', '-f', gs_path])
+
# Copy VERSION file.
from_loc = raw_namer.version_filepath(revision)
to_loc = release_namer.version_filepath(to_revision)
@@ -297,24 +325,29 @@ def _PromoteDartArchiveBuild(channel, revision):
# Copy sdk directory.
from_loc = raw_namer.sdk_directory(revision)
to_loc = release_namer.sdk_directory(to_revision)
+ remove_gs_directory(to_loc)
_Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
# Copy eclipse update directory.
from_loc = raw_namer.editor_eclipse_update_directory(revision)
to_loc = release_namer.editor_eclipse_update_directory(to_revision)
+ remove_gs_directory(to_loc)
_Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
- # Copy api-docs directory.
- from_loc = raw_namer.apidocs_directory(revision)
- to_loc = release_namer.apidocs_directory(to_revision)
- _Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
+ # Copy api-docs zipfile.
+ from_loc = raw_namer.apidocs_zipfilepath(revision)
+ to_loc = release_namer.apidocs_zipfilepath(to_revision)
+ _Gsutil(['-m', 'cp', '-a', 'public-read', from_loc, to_loc])
# Copy dartium directory.
from_loc = raw_namer.dartium_directory(revision)
to_loc = release_namer.dartium_directory(to_revision)
+ remove_gs_directory(to_loc)
_Gsutil(['-m', 'cp', '-a', 'public-read', '-R', from_loc, to_loc])
# Copy editor zip files.
+ target_editor_dir = release_namer.editor_directory(to_revision)
+ remove_gs_directory(target_editor_dir)
for system in ['windows', 'macos', 'linux']:
for arch in ['ia32', 'x64']:
from_namer = raw_namer
« no previous file with comments | « no previous file | tools/bots/bot_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698