summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-03-16 22:07:48 +0000
committerIan Lynagh <igloo@earth.li>2011-03-16 22:07:48 +0000
commitd93aa4f4421c2a99d1f5be816882de0018d0a56a (patch)
treed7359676574b28c6cb2a0910d798b8c6f5fb56e1 /distrib
parent42b40db07ce70b89f867247809c4e930fd82a6f6 (diff)
downloadhaskell-d93aa4f4421c2a99d1f5be816882de0018d0a56a.tar.gz
Bindist comparison tool: add --ignore-size-changes flag
Diffstat (limited to 'distrib')
-rw-r--r--distrib/compare/Problem.hs4
-rw-r--r--distrib/compare/compare.hs12
2 files changed, 12 insertions, 4 deletions
diff --git a/distrib/compare/Problem.hs b/distrib/compare/Problem.hs
index 399e4f804e..7854bc5f7d 100644
--- a/distrib/compare/Problem.hs
+++ b/distrib/compare/Problem.hs
@@ -11,6 +11,10 @@ data Problem = DuplicateFile FilePath
| PermissionsChanged FilePath FilePath String String
| FileSizeChanged FilePath FilePath Integer Integer
+isSizeChange :: FileProblem -> Bool
+isSizeChange (Change (FileSizeChanged {})) = True
+isSizeChange _ = False
+
pprFileProblem :: FileProblem -> String
pprFileProblem (First p) = "First " ++ pprProblem p
pprFileProblem (Second p) = "Second " ++ pprProblem p
diff --git a/distrib/compare/compare.hs b/distrib/compare/compare.hs
index b17faf08e2..14e83b6370 100644
--- a/distrib/compare/compare.hs
+++ b/distrib/compare/compare.hs
@@ -28,11 +28,12 @@ sizePercentage = 150
main :: IO ()
main = do args <- getArgs
case args of
- [bd1, bd2] -> doit bd1 bd2
+ [bd1, bd2] -> doit False bd1 bd2
+ ["--ignore-size-changes", bd1, bd2] -> doit True bd1 bd2
_ -> die ["Bad args. Need 2 bindists."]
-doit :: FilePath -> FilePath -> IO ()
-doit bd1 bd2
+doit :: Bool -> FilePath -> FilePath -> IO ()
+doit ignoreSizeChanges bd1 bd2
= do tls1 <- readTarLines bd1
tls2 <- readTarLines bd2
ways1 <- dieOnErrors $ findWays tls1
@@ -49,7 +50,10 @@ doit bd1 bd2
allProbs = map First nubProbs1 ++ map Second nubProbs2
++ diffWays ways1 ways2
++ differences
- mapM_ (putStrLn . pprFileProblem) allProbs
+ wantedProbs = if ignoreSizeChanges
+ then filter (not . isSizeChange) allProbs
+ else allProbs
+ mapM_ (putStrLn . pprFileProblem) wantedProbs
findWays :: [TarLine] -> Either Errors Ways
findWays = foldr f (Left ["Couldn't find ways"])