summaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-06 09:44:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-06 09:44:55 -0400
commit07c69b53358df2bce72d3a7aedc9b66a133c5037 (patch)
treeac3ea2babbfb51cbdb530e30af52215afdd8469f /Limit.hs
parentc34cc0d4a02b120712b9f92d0d7e7df0b57fc473 (diff)
Avoid depending on regex-tdfa on mips, mipsel, and s390, where it fails to build.
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Limit.hs b/Limit.hs
index 679ebc199..56887a5fb 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -13,8 +13,12 @@ import Data.Time.Clock.POSIX
import qualified Data.Set as S
import qualified Data.Map as M
import System.Path.WildMatch
+#ifdef WITH_TDFA
import Text.Regex.TDFA
import Text.Regex.TDFA.String
+#else
+import System.Path.WildMatch
+#endif
import Common.Annex
import qualified Annex
@@ -85,10 +89,11 @@ limitExclude :: MkLimit
limitExclude glob = Right $ const $ return . not . matchglob glob
{- Could just use wildCheckCase, but this way the regex is only compiled
- - once. Also, we use regex-TDFA because it's less buggy in its support
- - of non-unicode characters. -}
+ - once. Also, we use regex-TDFA when available, because it's less buggy
+ - in its support of non-unicode characters. -}
matchglob :: String -> Annex.FileInfo -> Bool
matchglob glob fi =
+#ifdef WITH_TDFA
case cregex of
Right r -> case execute r (Annex.matchFile fi) of
Right (Just _) -> True
@@ -97,6 +102,9 @@ matchglob glob fi =
where
cregex = compile defaultCompOpt defaultExecOpt regex
regex = '^':wildToRegex glob
+#else
+ wildCheckCase glob (Annex.matchFile fi)
+#endif
{- Adds a limit to skip files not believed to be present
- in a specfied repository. -}