3636
3737chromium_channel_json_url  =  'https://omahaproxy.appspot.com/all.json' 
3838
39+ shallow_git_depth_limit  =  '' 
40+ shallow_gclient_no_history  =  '' 
41+ 
42+ if  os .environ .get ('SHALLOW' ) ==  '1' :
43+ 	shallow_gclient_no_history  =  '--no-history' 
44+ 	shallow_git_depth_limit  =  '--depth 1' 
45+ 
46+ 
3947## 
4048# Global system variables. 
4149## 
@@ -182,7 +190,7 @@ def download_and_extract(src, target):
182190  """ Extracts the contents of src, which may be a URL or local file, to the 
183191      target directory. """ 
184192  temporary  =  False 
185- 
193+    sys . stdout . write ( "-------- downloading and extracting  \" %s \"  to  \" %s \" ... \n "   %  ( src ,  target )) 
186194  if  src [:4 ] ==  'http' :
187195    # Attempt to download a URL. 
188196    opener  =  FancyURLopener ({})
@@ -1181,7 +1189,7 @@ def check_pattern_matches(output_file=None):
11811189# Create the CEF checkout if necessary. 
11821190if  not  options .nocefupdate  and  not  os .path .exists (cef_dir ):
11831191  cef_checkout_new  =  True 
1184-   run ('%s clone %s %s'  %  (git_exe , cef_url , cef_dir ), download_dir ,
1192+   run ('%s clone %s %s %s '  %  (git_exe , shallow_git_depth_limit , cef_url , cef_dir ), download_dir ,
11851193      depot_tools_dir )
11861194else :
11871195  cef_checkout_new  =  False 
@@ -1191,8 +1199,8 @@ def check_pattern_matches(output_file=None):
11911199  cef_current_hash  =  get_git_hash (cef_dir , 'HEAD' )
11921200
11931201  if  not  cef_checkout_new :
1194-     # Fetch  updated sources. 
1195-     run ('%s fetch'  %  (git_exe ), cef_dir , depot_tools_dir )
1202+     # fetch --depth 1  updated sources. 
1203+     run ('%s fetch %s '  %  (git_exe ,  shallow_git_depth_limit ), cef_dir , depot_tools_dir )
11961204
11971205  cef_desired_hash  =  get_git_hash (cef_dir , cef_checkout )
11981206  cef_checkout_changed  =  cef_checkout_new  or  force_change  or  \
@@ -1287,7 +1295,7 @@ def check_pattern_matches(output_file=None):
12871295# Initial Chromium checkout. 
12881296if  not  options .nochromiumupdate  and  not  os .path .exists (chromium_src_dir ):
12891297  chromium_checkout_new  =  True 
1290-   run ("gclient sync --nohooks --with_branch_heads --jobs 16" , \
1298+   run ("gclient sync "    +   shallow_gclient_no_history   +   "  --nohooks --with_branch_heads --jobs 16"
12911299      chromium_dir , depot_tools_dir )
12921300else :
12931301  chromium_checkout_new  =  False 
@@ -1299,13 +1307,13 @@ def check_pattern_matches(output_file=None):
12991307if  os .path .exists (chromium_src_dir ):
13001308  msg ("Chromium URL: %s"  %  (get_git_url (chromium_src_dir )))
13011309
1302- # Fetch  Chromium changes so that we can perform the necessary calculations using 
1310+ # fetch  Chromium changes so that we can perform the necessary calculations using 
13031311# local history. 
13041312if  not  options .nochromiumupdate  and  os .path .exists (chromium_src_dir ):
1305-   # Fetch  updated sources. 
1306-   run ("%s fetch"  %  (git_exe ), chromium_src_dir , depot_tools_dir )
1313+   # fetch --depth 1  updated sources. 
1314+   run ("%s fetch %s "  %  (git_exe , shallow_git_depth_limit ), chromium_src_dir , depot_tools_dir )
13071315  # Also fetch tags, which are required for release branch builds. 
1308-   run ("%s fetch --tags"  %  (git_exe ), chromium_src_dir , depot_tools_dir )
1316+   run ("%s fetch %s  --tags"  %  (git_exe , shallow_git_depth_limit ), chromium_src_dir , depot_tools_dir )
13091317
13101318# Determine the Chromium checkout options required by CEF. 
13111319chromium_compat_version  =  build_compat_versions ['chromium_checkout' ]
@@ -1375,7 +1383,7 @@ def check_pattern_matches(output_file=None):
13751383  apply_deps_patch ()
13761384
13771385  # Update third-party dependencies including branch/tag information. 
1378-   run ("gclient sync %s--nohooks --with_branch_heads --jobs 16"  %  \
1386+   run ("gclient sync "    +   shallow_gclient_no_history   +   "  %s--nohooks --with_branch_heads --jobs 16"%  \
13791387      ('--reset '  if  discard_local_changes  else  '' ), chromium_dir , depot_tools_dir )
13801388
13811389  # Patch the Chromium runhooks scripts if necessary. 
0 commit comments