| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # vim: set ts=2 sw=2 et sts=2 ai: | 5 # vim: set ts=2 sw=2 et sts=2 ai: |
| 6 | 6 |
| 7 """Minimal tool to download binutils from Google storage. | 7 """Minimal tool to download binutils from Google storage. |
| 8 | 8 |
| 9 TODO(mithro): Replace with generic download_and_extract tool. | 9 TODO(mithro): Replace with generic download_and_extract tool. |
| 10 """ | 10 """ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 sha1file = tarball + '.sha1' | 58 sha1file = tarball + '.sha1' |
| 59 if not os.path.exists(sha1file): | 59 if not os.path.exists(sha1file): |
| 60 print "WARNING: No binutils found for your architecture (%s)!" % GetArch() | 60 print "WARNING: No binutils found for your architecture (%s)!" % GetArch() |
| 61 return 0 | 61 return 0 |
| 62 | 62 |
| 63 checksum = ReadFile(sha1file) | 63 checksum = ReadFile(sha1file) |
| 64 | 64 |
| 65 stampfile = tarball + '.stamp' | 65 stampfile = tarball + '.stamp' |
| 66 if os.path.exists(stampfile): | 66 if os.path.exists(stampfile): |
| 67 if checksum == ReadFile(stampfile): | 67 if (os.path.exists(tarball) and |
| 68 os.path.exists(outdir) and |
| 69 checksum == ReadFile(stampfile)): |
| 68 return 0 | 70 return 0 |
| 69 else: | 71 else: |
| 70 os.unlink(stampfile) | 72 os.unlink(stampfile) |
| 71 | 73 |
| 72 print "Downloading", tarball | 74 print "Downloading", tarball |
| 73 subprocess.check_call([ | 75 subprocess.check_call([ |
| 74 'download_from_google_storage', | 76 'download_from_google_storage', |
| 75 '--no_resume', | 77 '--no_resume', |
| 76 '--no_auth', | 78 '--no_auth', |
| 77 '--bucket', 'chromium-binutils', | 79 '--bucket', 'chromium-binutils', |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 | 91 |
| 90 for tool in BINUTILS_TOOLS: | 92 for tool in BINUTILS_TOOLS: |
| 91 assert os.path.exists(os.path.join(outdir, tool)) | 93 assert os.path.exists(os.path.join(outdir, tool)) |
| 92 | 94 |
| 93 WriteFile(stampfile, checksum) | 95 WriteFile(stampfile, checksum) |
| 94 return 0 | 96 return 0 |
| 95 | 97 |
| 96 | 98 |
| 97 if __name__ == '__main__': | 99 if __name__ == '__main__': |
| 98 sys.exit(main(sys.argv)) | 100 sys.exit(main(sys.argv)) |
| OLD | NEW |