| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """ Download the SKPs. """ | |
| 7 | |
| 8 from build_step import BuildStep | |
| 9 from utils import old_gs_utils as gs_utils | |
| 10 from utils import sync_bucket_subdir | |
| 11 import os | |
| 12 import posixpath | |
| 13 import sys | |
| 14 | |
| 15 | |
| 16 class DownloadSKPs(BuildStep): | |
| 17 def __init__(self, timeout=12800, no_output_timeout=9600, **kwargs): | |
| 18 super (DownloadSKPs, self).__init__( | |
| 19 timeout=timeout, | |
| 20 no_output_timeout=no_output_timeout, | |
| 21 **kwargs) | |
| 22 | |
| 23 def _Run(self): | |
| 24 dest_gsbase = (self._args.get('dest_gsbase') or | |
| 25 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | |
| 26 version_file = 'SKP_VERSION' | |
| 27 expected_skp_version = None | |
| 28 with open(version_file) as f: | |
| 29 expected_skp_version = f.read().rstrip() | |
| 30 actual_skp_version = None | |
| 31 actual_version_file = os.path.join( | |
| 32 self._local_playback_dirs.PlaybackSkpDir(), version_file) | |
| 33 if os.path.isfile(actual_version_file): | |
| 34 with open(actual_version_file) as f: | |
| 35 actual_skp_version = f.read().rstrip() | |
| 36 if actual_skp_version != expected_skp_version: | |
| 37 self._flavor_utils.CreateCleanHostDirectory( | |
| 38 self._local_playback_dirs.PlaybackSkpDir()) | |
| 39 gs_relative_dir = ( | |
| 40 self._storage_playback_dirs.PlaybackSkpDir(expected_skp_version)) | |
| 41 print '\n\n========Downloading skp files from Google Storage========\n\n' | |
| 42 gs_utils.download_dir_contents( | |
| 43 remote_src_dir=posixpath.join(dest_gsbase, gs_relative_dir), | |
| 44 local_dest_dir=self._local_playback_dirs.PlaybackRootDir(), | |
| 45 multi=False) | |
| 46 with open(actual_version_file, 'w') as f: | |
| 47 f.write(expected_skp_version) | |
| 48 | |
| 49 | |
| 50 if '__main__' == __name__: | |
| 51 sys.exit(BuildStep.RunBuildStep(DownloadSKPs)) | |
| OLD | NEW |