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

Unified Diff: tools/get_archive.py

Issue 10867005: Made get_archive.py resilient to 403 forbidden errors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/get_archive.py
===================================================================
--- tools/get_archive.py (revision 11075)
+++ tools/get_archive.py (working copy)
@@ -160,7 +160,19 @@
# First try to find one with the the second number the same as the
# requested number.
latest = out.split()[0]
- foundURL = True
+ # Now test that the permissions are correct so you can actually
+ # download it.
+ temp_dir = tempfile.mkdtemp()
+ temp_zip = os.path.join(temp_dir, 'foo.zip')
+ returncode, out = Gsutil('cp', latest, 'file://' + temp_zip)
+ if returncode == 0:
+ foundURL = True
+ else:
+ # Unable to download this item (most likely because something went
+ # wrong on the upload and the permissions are bad). Keep looking for
+ # a different URL.
+ revision_num = int(revision_num) - 1
+ shutil.rmtree(temp_dir)
else:
# Now try to find one with a nearby CL num.
revision_num = int(revision_num) - 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698