@@ -25,7 +25,6 @@ use std::process::Command;
25
25
26
26
use { Build , Compiler } ;
27
27
use util:: { cp_r, libdir, is_dylib, cp_filtered, copy} ;
28
- use regex:: { RegexSet , quote} ;
29
28
30
29
pub fn package_vers ( build : & Build ) -> & str {
31
30
match & build. config . channel [ ..] {
@@ -315,49 +314,31 @@ pub fn rust_src(build: &Build) {
315
314
"mk"
316
315
] ;
317
316
318
- // Exclude paths matching these wildcard expressions
319
- let excludes = [
320
- // exclude-vcs
321
- "CVS" , "RCS" , "SCCS" , ".git" , ".gitignore" , ".gitmodules" , ".gitattributes" , ".cvsignore" ,
322
- ".svn" , ".arch-ids" , "{arch}" , "=RELEASE-ID" , "=meta-update" , "=update" , ".bzr" ,
323
- ".bzrignore" , ".bzrtags" , ".hg" , ".hgignore" , ".hgrags" , "_darcs" ,
324
- // extensions
325
- "*~" , "*.pyc" ,
326
- // misc
327
- "llvm/test/*/*.ll" ,
328
- "llvm/test/*/*.td" ,
329
- "llvm/test/*/*.s" ,
330
- "llvm/test/*/*/*.ll" ,
331
- "llvm/test/*/*/*.td" ,
332
- "llvm/test/*/*/*.s"
333
- ] ;
334
-
335
- // Construct a set of regexes for efficiently testing whether paths match one of the above
336
- // expressions.
337
- let regex_set = t ! ( RegexSet :: new(
338
- // This converts a wildcard expression to a regex
339
- excludes. iter( ) . map( |& s| {
340
- // Prefix ensures that matching starts on a path separator boundary
341
- r"^(.*[\\/])?" . to_owned( ) + (
342
- // Escape the expression to produce a regex matching exactly that string
343
- & quote( s)
344
- // Replace slashes with a pattern matching either forward or backslash
345
- . replace( r"/" , r"[\\/]" )
346
- // Replace wildcards with a pattern matching a single path segment, ie. containing
347
- // no slashes.
348
- . replace( r"\*" , r"[^\\/]*" )
349
- // Suffix anchors to the end of the path
350
- ) + "$"
351
- } )
352
- ) ) ;
353
-
354
- // Create a filter which skips files which match the regex set or contain invalid unicode
355
317
let filter_fn = move |path : & Path | {
356
- if let Some ( path) = path. to_str ( ) {
357
- !regex_set. is_match ( path)
358
- } else {
359
- false
318
+ let spath = match path. to_str ( ) {
319
+ Some ( path) => path,
320
+ None => return false ,
321
+ } ;
322
+ if spath. ends_with ( "~" ) || spath. ends_with ( ".pyc" ) {
323
+ return false
360
324
}
325
+ if spath. contains ( "llvm/test" ) || spath. contains ( "llvm\\ test" ) {
326
+ if spath. ends_with ( ".ll" ) ||
327
+ spath. ends_with ( ".td" ) ||
328
+ spath. ends_with ( ".s" ) {
329
+ return false
330
+ }
331
+ }
332
+
333
+ let excludes = [
334
+ "CVS" , "RCS" , "SCCS" , ".git" , ".gitignore" , ".gitmodules" ,
335
+ ".gitattributes" , ".cvsignore" , ".svn" , ".arch-ids" , "{arch}" ,
336
+ "=RELEASE-ID" , "=meta-update" , "=update" , ".bzr" , ".bzrignore" ,
337
+ ".bzrtags" , ".hg" , ".hgignore" , ".hgrags" , "_darcs" ,
338
+ ] ;
339
+ !path. iter ( )
340
+ . map ( |s| s. to_str ( ) . unwrap ( ) )
341
+ . any ( |s| excludes. contains ( & s) )
361
342
} ;
362
343
363
344
// Copy the directories using our filter
0 commit comments