@@ -1163,47 +1163,35 @@ def build_triple(self):
11631163 return config or default_build_triple (self .verbose )
11641164
11651165 def is_git_repository (self , repo_path ):
1166- return (
1167- subprocess .run (
1168- ["git" , "-C" , repo_path , "rev-parse" , "--is-inside-work-tree" ],
1169- stdout = subprocess .DEVNULL ,
1170- stderr = subprocess .DEVNULL ,
1171- ).returncode
1172- == 0
1173- )
1166+ return os .path .isdir (os .path .join (repo_path , ".git" ))
11741167
1175- def get_latest_commit (self , repo_path , branch , author_email ):
1168+ def get_latest_commit (self , repo_path , author_email ):
11761169 try :
11771170 if not self .is_git_repository (repo_path ):
11781171 return "<commit>"
11791172 cmd = [
11801173 "git" ,
11811174 "-C" ,
11821175 repo_path ,
1183- "log" ,
1184- "--format=%H" ,
1176+ "rev-list" ,
11851177 "--author" ,
11861178 author_email ,
1187- branch ,
1188- "-n" ,
1189- "1" ,
1179+ "-n1" ,
1180+ "HEAD" ,
11901181 ]
11911182 commit = subprocess .check_output (cmd , text = True ).strip ()
11921183 return commit if commit else "<commit>"
11931184 except subprocess .CalledProcessError :
11941185 return "<commit>"
11951186
1196- def get_values (self ):
1187+ def get_value (self ):
11971188 file_path = f"{ self .rust_root } /src/stage0"
1198- print (file_path )
1199- keys = ["git_merge_commit_email" , "nightly_branch" ]
1200- values = []
1189+ target_key = "git_merge_commit_email"
12011190 with open (file_path , "r" ) as file :
12021191 for line in file :
1203- for key in keys :
1204- if line .startswith (f"{ key } =" ):
1205- values .append (line .split ("=" , 1 )[1 ].strip ())
1206- return values
1192+ if line .startswith (f"{ target_key } =" ):
1193+ return line .split ("=" , 1 )[1 ].strip ()
1194+ return None
12071195
12081196 def check_vendored_status (self ):
12091197 """Check that vendoring is configured properly"""
@@ -1218,12 +1206,9 @@ def check_vendored_status(self):
12181206
12191207 cargo_dir = os .path .join (self .rust_root , ".cargo" )
12201208 repo_path = self .rust_root
1221- git_merge_commit_email , nightly_branch = self .get_values ()
1222- commit = self .get_latest_commit (
1223- repo_path , nightly_branch , git_merge_commit_email
1224- )
1209+ git_merge_commit_email = self .get_value ()
1210+ commit = self .get_latest_commit (repo_path , git_merge_commit_email )
12251211 url = f"https://ci-artifacts.rust-lang.org/rustc-builds/{ commit } /rustc-nightly-src.tar.xz"
1226-
12271212 if self .use_vendored_sources :
12281213 vendor_dir = os .path .join (self .rust_root , "vendor" )
12291214 if not os .path .exists (vendor_dir ):
0 commit comments