@@ -25,7 +25,6 @@ use std::process::Command;
2525
2626use { Build , Compiler } ;
2727use util:: { cp_r, libdir, is_dylib, cp_filtered, copy} ;
28- use regex:: { RegexSet , quote} ;
2928
3029pub fn package_vers ( build : & Build ) -> & str {
3130 match & build. config . channel [ ..] {
@@ -315,49 +314,31 @@ pub fn rust_src(build: &Build) {
315314 "mk"
316315 ] ;
317316
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
355317 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
360324 }
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) )
361342 } ;
362343
363344 // Copy the directories using our filter
0 commit comments