@@ -1163,47 +1163,35 @@ def build_triple(self):
1163
1163
return config or default_build_triple (self .verbose )
1164
1164
1165
1165
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" ))
1174
1167
1175
- def get_latest_commit (self , repo_path , branch , author_email ):
1168
+ def get_latest_commit (self , repo_path , author_email ):
1176
1169
try :
1177
1170
if not self .is_git_repository (repo_path ):
1178
1171
return "<commit>"
1179
1172
cmd = [
1180
1173
"git" ,
1181
1174
"-C" ,
1182
1175
repo_path ,
1183
- "log" ,
1184
- "--format=%H" ,
1176
+ "rev-list" ,
1185
1177
"--author" ,
1186
1178
author_email ,
1187
- branch ,
1188
- "-n" ,
1189
- "1" ,
1179
+ "-n1" ,
1180
+ "HEAD" ,
1190
1181
]
1191
1182
commit = subprocess .check_output (cmd , text = True ).strip ()
1192
1183
return commit if commit else "<commit>"
1193
1184
except subprocess .CalledProcessError :
1194
1185
return "<commit>"
1195
1186
1196
- def get_values (self ):
1187
+ def get_value (self ):
1197
1188
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"
1201
1190
with open (file_path , "r" ) as file :
1202
1191
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
1207
1195
1208
1196
def check_vendored_status (self ):
1209
1197
"""Check that vendoring is configured properly"""
@@ -1218,12 +1206,9 @@ def check_vendored_status(self):
1218
1206
1219
1207
cargo_dir = os .path .join (self .rust_root , ".cargo" )
1220
1208
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 )
1225
1211
url = f"https://ci-artifacts.rust-lang.org/rustc-builds/{ commit } /rustc-nightly-src.tar.xz"
1226
-
1227
1212
if self .use_vendored_sources :
1228
1213
vendor_dir = os .path .join (self .rust_root , "vendor" )
1229
1214
if not os .path .exists (vendor_dir ):
0 commit comments