42
42
# Temporary work directory
43
43
temp_dir = sys .argv [6 ]
44
44
45
+ cargo_addy = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds"
46
+
45
47
print "channel: " + channel
46
48
print "today: " + today
47
49
print "s3_addy: " + s3_addy
130
132
"i686-pc-windows-gnu" ,
131
133
])
132
134
133
- # This file defines which cargos go with which rustc on beta/stable
134
- cargo_revs = "https://raw.githubusercontent.com/rust-lang/rust-packaging/master/cargo-revs.txt"
135
-
136
135
if os .path .isdir (temp_dir ):
137
136
shutil .rmtree (temp_dir )
138
137
os .mkdir (temp_dir )
@@ -154,28 +153,29 @@ def main():
154
153
# on s3.
155
154
rustc_short_version = parse_short_version (rustc_version )
156
155
157
- cargo_date = None
158
156
if channel == "nightly" :
159
- # Nightly rust is paired with nightly cargo
160
- cargo_date = most_recent_build_date ("nightly" , "cargo" )
157
+ cargo_branch = 'master'
161
158
else :
162
- # Beta / stable rust is paired with a cargo specified
163
- # by rust-packaging
164
- cargo_date = cargo_date_from_packaging (rustc_short_version )
159
+ cargo_branch = 'rust-' + rustc_short_version
160
+ if channel == "nightly" :
161
+ cargo_branch = 'master'
162
+ cargo_rev_url = "https://api.github.com/repos/rust-lang/cargo/commits/" + cargo_branch
163
+ request = urllib2 .Request (cargo_rev_url , headers = {"Accept" : "Accept: application/vnd.github.3.sha" })
164
+ cargo_rev = urllib2 .urlopen (request ).read ()
165
165
166
- cargo_version = version_from_channel ("nightly" , "cargo" , cargo_date )
166
+ cargo_version = version_from_channel (channel , "cargo" , cargo_rev )
167
167
cargo_short_version = parse_short_version (cargo_version )
168
168
169
169
print "rustc date: " + rustc_date
170
170
print "rustc version: " + rustc_version
171
171
print "rustc short version: " + rustc_short_version
172
- print "cargo date : " + cargo_date
172
+ print "cargo rev : " + cargo_rev
173
173
print "cargo version: " + cargo_version
174
174
print "cargo short version: " + cargo_short_version
175
175
176
176
# Validate the component artifacts and generate the manifest
177
177
generate_manifest (rustc_date , rustc_version , rustc_short_version ,
178
- cargo_date , cargo_version , cargo_short_version )
178
+ cargo_rev , cargo_version , cargo_short_version )
179
179
180
180
# Use the channel-$component-$channel-date.txt file to get the archive
181
181
# date for cargo or rustc. These files are generated by finish_dist
@@ -195,25 +195,31 @@ def most_recent_build_date(channel, component):
195
195
def version_from_channel (channel , component , date ):
196
196
dist = dist_folder (component )
197
197
198
- # Load the manifest
199
- manifest_url = s3_addy + "/" + dist + "/" + date + "/channel-" + component + "-" + channel
200
- print "downloading " + manifest_url
201
- response = urllib2 .urlopen (manifest_url )
202
- if response .getcode () != 200 :
203
- raise Exception ("couldn't download " + manifest_url )
204
- manifest = response .read ().strip ();
198
+ if component == "cargo" :
199
+ target = "x86_64-unknown-linux-gnu"
200
+ installer_name = "cargo-nightly-" + target + ".tar.gz"
201
+ installer_url = cargo_addy + "/" + date + "/" + installer_name
202
+ else :
203
+ # Load the manifest
204
+ manifest_url = s3_addy + "/" + dist + "/" + date + "/channel-" + component + "-" + channel
205
+ print "downloading " + manifest_url
206
+ response = urllib2 .urlopen (manifest_url )
207
+ if response .getcode () != 200 :
208
+ raise Exception ("couldn't download " + manifest_url )
209
+ manifest = response .read ().strip ();
210
+
211
+ # Find the installer name
212
+ installer_name = None
213
+ for line in manifest .split ("\n " ):
214
+ if line .startswith (component ) and line .endswith (".tar.gz" ):
215
+ installer_name = line
205
216
206
- # Find the installer name
207
- installer_name = None
208
- for line in manifest .split ("\n " ):
209
- if line .startswith (component ) and line .endswith (".tar.gz" ):
210
- installer_name = line
217
+ if installer_name == None :
218
+ raise Exception ("couldn't find installer in manifest for " + component )
211
219
212
- if installer_name == None :
213
- raise Exception ("couldn't find installer in manifest for " + component )
220
+ installer_url = s3_addy + "/" + dist + "/" + date + "/" + installer_name
214
221
215
222
# Download the installer
216
- installer_url = s3_addy + "/" + dist + "/" + date + "/" + installer_name
217
223
print "downloading " + installer_url
218
224
response = urllib2 .urlopen (installer_url )
219
225
if response .getcode () != 200 :
@@ -249,7 +255,7 @@ def dist_folder(component):
249
255
return "cargo-dist"
250
256
return "dist"
251
257
252
- def cargo_date_from_packaging (rustc_version ):
258
+ def cargo_rev_from_packaging (rustc_version ):
253
259
print "downloading " + cargo_revs
254
260
response = urllib2 .urlopen (cargo_revs )
255
261
if response .getcode () != 200 :
@@ -275,10 +281,10 @@ def parse_short_version(version):
275
281
return v
276
282
277
283
def generate_manifest (rustc_date , rustc_version , rustc_short_version ,
278
- cargo_date , cargo_version , cargo_short_version ):
284
+ cargo_rev , cargo_version , cargo_short_version ):
279
285
280
286
m = build_manifest (rustc_date , rustc_version , rustc_short_version ,
281
- cargo_date , cargo_version , cargo_short_version )
287
+ cargo_rev , cargo_version , cargo_short_version )
282
288
283
289
manifest_name = "channel-rust-" + channel + ".toml"
284
290
manifest_file = rust_package_dir + "/" + manifest_name
@@ -293,7 +299,7 @@ def generate_manifest(rustc_date, rustc_version, rustc_short_version,
293
299
print_summary (m )
294
300
295
301
def build_manifest (rustc_date , rustc_version , rustc_short_version ,
296
- cargo_date , cargo_version , cargo_short_version ):
302
+ cargo_rev , cargo_version , cargo_short_version ):
297
303
298
304
packages = {}
299
305
@@ -308,7 +314,7 @@ def build_manifest(rustc_date, rustc_version, rustc_short_version,
308
314
doc_pkg = build_package_def_from_archive ("rust-docs" , "dist" , rustc_date ,
309
315
rustc_version , rustc_short_version ,
310
316
host_list )
311
- cargo_pkg = build_package_def_from_archive ("cargo" , "cargo-dist" , cargo_date ,
317
+ cargo_pkg = build_package_def_from_archive ("cargo" , "cargo-dist" , cargo_rev ,
312
318
cargo_version , cargo_short_version ,
313
319
host_list )
314
320
mingw_pkg = build_package_def_from_archive ("rust-mingw" , "dist" , rustc_date ,
@@ -437,17 +443,17 @@ def build_package_def_from_archive(name, dist_dir, archive_date,
437
443
def live_package_url (name , dist_dir , date , version , target ):
438
444
# Cargo builds are always named 'nightly'
439
445
maybe_channel = channel
440
- if name == "cargo" :
441
- maybe_channel = "nightly"
442
446
443
- if name == "rust-src" :
447
+ if name == "cargo" :
448
+ url1 = cargo_addy + "/" + date + "/cargo-nightly-" + target + ".tar.gz"
449
+ elif name == "rust-src" :
444
450
# The build system treats source packages as a separate target for `rustc`
445
451
# but for rustup we'd like to treat them as a completely separate package.
446
452
url1 = s3_addy + "/" + dist_dir + "/" + date + "/rust-src-" + version + ".tar.gz"
447
- url2 = s3_addy + "/" + dist_dir + "/" + date + "/rust-src-" + maybe_channel + ".tar.gz"
453
+ url2 = s3_addy + "/" + dist_dir + "/" + date + "/rust-src-" + channel + ".tar.gz"
448
454
else :
449
455
url1 = s3_addy + "/" + dist_dir + "/" + date + "/" + name + "-" + version + "-" + target + ".tar.gz"
450
- url2 = s3_addy + "/" + dist_dir + "/" + date + "/" + name + "-" + maybe_channel + "-" + target + ".tar.gz"
456
+ url2 = s3_addy + "/" + dist_dir + "/" + date + "/" + name + "-" + channel + "-" + target + ".tar.gz"
451
457
452
458
print "checking " + url1
453
459
request = urllib2 .Request (url1 )
0 commit comments