1
- import re , os , sys , hashlib , tarfile , shutil , subprocess , tempfile
1
+ import re , os , sys , glob , hashlib , tarfile , shutil , subprocess , tempfile
2
2
3
3
def scrub (b ):
4
4
if sys .version_info >= (3 ,) and type (b ) == bytes :
@@ -17,18 +17,18 @@ def scrub(b):
17
17
18
18
snapshot_files = {
19
19
"linux" : ["bin/rustc" ,
20
- "lib/libcore.so" ,
21
- "lib/libruststd .so" ,
20
+ "lib/libcore-* .so" ,
21
+ "lib/libstd-* .so" ,
22
22
"lib/librustrt.so" ,
23
23
"lib/librustllvm.so" ],
24
24
"macos" : ["bin/rustc" ,
25
- "lib/libcore.dylib" ,
26
- "lib/libruststd .dylib" ,
25
+ "lib/libcore-* .dylib" ,
26
+ "lib/libstd-* .dylib" ,
27
27
"lib/librustrt.dylib" ,
28
28
"lib/librustllvm.dylib" ],
29
29
"winnt" : ["bin/rustc.exe" ,
30
- "lib/core.dll" ,
31
- "lib/ruststd .dll" ,
30
+ "lib/core-* .dll" ,
31
+ "lib/std-* .dll" ,
32
32
"lib/rustrt.dll" ,
33
33
"lib/rustllvm.dll" ]
34
34
}
@@ -128,13 +128,25 @@ def make_snapshot(stage, triple, flag):
128
128
129
129
file0 = partial_snapshot_name (date , rev , platform )
130
130
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
+
131
136
tar = tarfile .open (file0 , "w:bz2" )
132
137
for name in snapshot_files [kernel ]:
133
138
dir = stage
134
139
if stage == "stage1" and re .match (r"^lib/(lib)?std.*" , name ):
135
140
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 ))
138
150
tar .close ()
139
151
140
152
h = hash_file (file0 )
0 commit comments