OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 | 5 |
6 """Install Debian Wheezy sysroots for building chromium. | 6 """Install Debian Wheezy sysroots for building chromium. |
7 """ | 7 """ |
8 | 8 |
9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy, | 9 # The sysroot is needed to ensure that binaries will run on Debian Wheezy, |
10 # the oldest supported linux distribution. This script can be run manually but | 10 # the oldest supported linux distribution. This script can be run manually but |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 revision = REVISION_MIPS | 182 revision = REVISION_MIPS |
183 else: | 183 else: |
184 raise Error('Unknown architecture: %s' % target_arch) | 184 raise Error('Unknown architecture: %s' % target_arch) |
185 | 185 |
186 url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) | 186 url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename) |
187 | 187 |
188 stamp = os.path.join(sysroot, '.stamp') | 188 stamp = os.path.join(sysroot, '.stamp') |
189 if os.path.exists(stamp): | 189 if os.path.exists(stamp): |
190 with open(stamp) as s: | 190 with open(stamp) as s: |
191 if s.read() == url: | 191 if s.read() == url: |
192 print 'Debian Wheezy %s root image already up-to-date: %s' % \ | 192 print 'Debian Wheezy %s root image already up to date: %s' % \ |
193 (target_arch, sysroot) | 193 (target_arch, sysroot) |
194 return | 194 return |
195 | 195 |
196 print 'Installing Debian Wheezy %s root image: %s' % (target_arch, sysroot) | 196 print 'Installing Debian Wheezy %s root image: %s' % (target_arch, sysroot) |
197 if os.path.isdir(sysroot): | 197 if os.path.isdir(sysroot): |
198 shutil.rmtree(sysroot) | 198 shutil.rmtree(sysroot) |
199 os.mkdir(sysroot) | 199 os.mkdir(sysroot) |
200 tarball = os.path.join(sysroot, tarball_filename) | 200 tarball = os.path.join(sysroot, tarball_filename) |
201 print 'Downloading %s' % url | 201 print 'Downloading %s' % url |
202 sys.stdout.flush() | 202 sys.stdout.flush() |
(...skipping 10 matching lines...) Expand all Loading... |
213 with open(stamp, 'w') as s: | 213 with open(stamp, 'w') as s: |
214 s.write(url) | 214 s.write(url) |
215 | 215 |
216 | 216 |
217 if __name__ == '__main__': | 217 if __name__ == '__main__': |
218 try: | 218 try: |
219 sys.exit(main(sys.argv[1:])) | 219 sys.exit(main(sys.argv[1:])) |
220 except Error as e: | 220 except Error as e: |
221 sys.stderr.write(str(e) + '\n') | 221 sys.stderr.write(str(e) + '\n') |
222 sys.exit(1) | 222 sys.exit(1) |
OLD | NEW |