Skip to content

Commit 03d1644

Browse files
lhtgraydon
authored andcommitted
Update snapshot scripts to pick up the versioned libraries
1 parent 6dbd4c2 commit 03d1644

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/etc/snapshot.py

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import re, os, sys, hashlib, tarfile, shutil, subprocess, tempfile
1+
import re, os, sys, glob, hashlib, tarfile, shutil, subprocess, tempfile
22

33
def scrub(b):
44
if sys.version_info >= (3,) and type(b) == bytes:
@@ -17,18 +17,18 @@ def scrub(b):
1717

1818
snapshot_files = {
1919
"linux": ["bin/rustc",
20-
"lib/libcore.so",
21-
"lib/libruststd.so",
20+
"lib/libcore-*.so",
21+
"lib/libstd-*.so",
2222
"lib/librustrt.so",
2323
"lib/librustllvm.so"],
2424
"macos": ["bin/rustc",
25-
"lib/libcore.dylib",
26-
"lib/libruststd.dylib",
25+
"lib/libcore-*.dylib",
26+
"lib/libstd-*.dylib",
2727
"lib/librustrt.dylib",
2828
"lib/librustllvm.dylib"],
2929
"winnt": ["bin/rustc.exe",
30-
"lib/core.dll",
31-
"lib/ruststd.dll",
30+
"lib/core-*.dll",
31+
"lib/std-*.dll",
3232
"lib/rustrt.dll",
3333
"lib/rustllvm.dll"]
3434
}
@@ -128,13 +128,25 @@ def make_snapshot(stage, triple, flag):
128128

129129
file0 = partial_snapshot_name(date, rev, platform)
130130

131+
def in_tar_name(fn):
132+
cs = fn.split(os.sep)
133+
if len(cs) >= 2:
134+
return os.sep.join(cs[-2:])
135+
131136
tar = tarfile.open(file0, "w:bz2")
132137
for name in snapshot_files[kernel]:
133138
dir = stage
134139
if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
135140
dir = "stage0"
136-
tar.add(os.path.join(triple, os.path.join(dir, name)),
137-
"rust-stage0/" + name)
141+
fn_glob = os.path.join(triple, dir, name)
142+
matches = glob.glob(fn_glob)
143+
if not matches:
144+
raise Exception("Not found file with name like " + fn_glob)
145+
if len(matches) == 1:
146+
tar.add(matches[0], "rust-stage0/" + in_tar_name(matches[0]))
147+
else:
148+
raise Exception("Found stale files: \n %s\n\
149+
Please make a clean build." % "\n ".join(matches))
138150
tar.close()
139151

140152
h = hash_file(file0)

0 commit comments

Comments
 (0)