2 # Copyright 2015 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.
10 from telemetry
.core
import util
12 sys
.path
.insert(1, os
.path
.abspath(os
.path
.join(
13 util
.GetCatapultDir(), 'common', 'py_utils')))
14 sys
.path
.insert(1, os
.path
.abspath(os
.path
.join(
15 util
.GetCatapultDir(), 'dependency_manager')))
16 from py_utils
import cloud_storage
17 import dependency_manager
20 def ValidateCloudStorageDependencies(file_path
):
21 base_config
= dependency_manager
.BaseConfig(file_path
)
22 cloud_storage_deps_not_exist
= []
23 for dep_info
in base_config
.IterDependencyInfo():
24 if dep_info
.has_cloud_storage_info
:
25 if not dep_info
.cloud_storage_info
.DependencyExistsInCloudStorage():
26 print >> sys
.stderr
, (
27 '%s does not exist in cloud storage' % dep_info
.cloud_storage_info
)
28 cloud_storage_deps_not_exist
= True
30 print >> sys
.stdout
, (
31 '%s passes cloud storage validation' % dep_info
.dependency
)
33 if cloud_storage_deps_not_exist
:
35 "Some dependencies specify cloud storage locations that don't exist.")
39 parser
= argparse
.ArgumentParser(
40 description
='Validate the dependencies in a binary dependency json file')
41 parser
.add_argument('file_path', type=str,
42 help='The path to binary dependency json file')
43 options
= parser
.parse_args(args
)
44 ValidateCloudStorageDependencies(options
.file_path
)
48 if __name__
== '__main__':
49 sys
.exit(Main(sys
.argv
[1:]))