@ -765,6 +765,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if len ( object_name_set ) != len ( dep_value [ ' objects ' ] ) :
if len ( object_name_set ) != len ( dep_value [ ' objects ' ] ) :
raise Exception ( ' Duplicate object names detected in {} GCS '
raise Exception ( ' Duplicate object names detected in {} GCS '
' dependency. ' . format ( name ) )
' dependency. ' . format ( name ) )
gcs_root = self . GetGcsRoot ( )
for obj in dep_value [ ' objects ' ] :
for obj in dep_value [ ' objects ' ] :
deps_to_add . append (
deps_to_add . append (
GcsDependency ( parent = self ,
GcsDependency ( parent = self ,
@ -774,6 +775,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
sha256sum = obj [ ' sha256sum ' ] ,
sha256sum = obj [ ' sha256sum ' ] ,
output_file = obj . get ( ' output_file ' ) ,
output_file = obj . get ( ' output_file ' ) ,
size_bytes = obj [ ' size_bytes ' ] ,
size_bytes = obj [ ' size_bytes ' ] ,
gcs_root = gcs_root ,
custom_vars = self . custom_vars ,
custom_vars = self . custom_vars ,
should_process = should_process ,
should_process = should_process ,
relative = use_relative_paths ,
relative = use_relative_paths ,
@ -1223,6 +1225,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if self . should_recurse :
if self . should_recurse :
self . ParseDepsFile ( )
self . ParseDepsFile ( )
gcs_root = self . GetGcsRoot ( )
if gcs_root :
if command == ' revert ' :
gcs_root . clobber ( )
elif command == ' update ' :
gcs_root . clobber_deps_with_updated_objects ( self . name )
self . _run_is_done ( file_list or [ ] )
self . _run_is_done ( file_list or [ ] )
@ -1236,6 +1244,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
for s in self . dependencies :
for s in self . dependencies :
if s . should_process :
if s . should_process :
work_queue . enqueue ( s )
work_queue . enqueue ( s )
gcs_root = self . GetGcsRoot ( )
if gcs_root and command == ' update ' :
gcs_root . resolve_objects ( self . name )
if command == ' recurse ' :
if command == ' recurse ' :
# Skip file only checkout.
# Skip file only checkout.
@ -1389,6 +1400,13 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
return None
return None
return self . root . GetCipdRoot ( )
return self . root . GetCipdRoot ( )
def GetGcsRoot ( self ) :
if self . root is self :
# Let's not infinitely recurse. If this is root and isn't an
# instance of GClient, do nothing.
return None
return self . root . GetGcsRoot ( )
def subtree ( self , include_all ) :
def subtree ( self , include_all ) :
""" Breadth first recursion excluding root node. """
""" Breadth first recursion excluding root node. """
dependencies = self . dependencies
dependencies = self . dependencies
@ -1709,6 +1727,7 @@ solutions = %(solution_list)s
self . _enforced_cpu = ( detect_host_arch . HostArch ( ) , )
self . _enforced_cpu = ( detect_host_arch . HostArch ( ) , )
self . _root_dir = root_dir
self . _root_dir = root_dir
self . _cipd_root = None
self . _cipd_root = None
self . _gcs_root = None
self . config_content = None
self . config_content = None
def _CheckConfig ( self ) :
def _CheckConfig ( self ) :
@ -2494,6 +2513,11 @@ it or fix the checkout.
log_level = ' info ' if self . _options . verbose else None )
log_level = ' info ' if self . _options . verbose else None )
return self . _cipd_root
return self . _cipd_root
def GetGcsRoot ( self ) :
if not self . _gcs_root :
self . _gcs_root = gclient_scm . GcsRoot ( self . root_dir )
return self . _gcs_root
@property
@property
def root_dir ( self ) :
def root_dir ( self ) :
""" Root directory of gclient checkout. """
""" Root directory of gclient checkout. """
@ -2517,14 +2541,16 @@ class GcsDependency(Dependency):
""" A Dependency object that represents a single GCS bucket and object """
""" A Dependency object that represents a single GCS bucket and object """
def __init__ ( self , parent , name , bucket , object_name , sha256sum ,
def __init__ ( self , parent , name , bucket , object_name , sha256sum ,
output_file , size_bytes , custom_vars, should_process , relative ,
output_file , size_bytes , gcs_root, custom_vars, should_process ,
condition) :
relative, condition) :
self . bucket = bucket
self . bucket = bucket
self . object_name = object_name
self . object_name = object_name
self . sha256sum = sha256sum
self . sha256sum = sha256sum
self . output_file = output_file
self . output_file = output_file
self . size_bytes = size_bytes
self . size_bytes = size_bytes
url = f ' gs:// { self . bucket } / { self . object_name } '
url = f ' gs:// { self . bucket } / { self . object_name } '
self . _gcs_root = gcs_root
self . _gcs_root . add_object ( parent . name , name , object_name )
super ( GcsDependency , self ) . __init__ ( parent = parent ,
super ( GcsDependency , self ) . __init__ ( parent = parent ,
name = f ' { name } : { object_name } ' ,
name = f ' { name } : { object_name } ' ,
url = url ,
url = url ,