summaryrefslogtreecommitdiff
path: root/distrib/compare
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-05-30 16:04:17 +0100
committerIan Lynagh <igloo@earth.li>2012-05-30 16:04:17 +0100
commit80c3d5ad531c96560a25f35323b538e6986e65f0 (patch)
tree58effd44fa18095cf126eee84914f0f9ab2f0ac5 /distrib/compare
parent6d0df457256c76149f76f3d1067cdad7aaa3434c (diff)
downloadhaskell-80c3d5ad531c96560a25f35323b538e6986e65f0.tar.gz
Improve the size-change detection heuristics in the compare tool
Diffstat (limited to 'distrib/compare')
-rw-r--r--distrib/compare/compare.hs23
1 files changed, 13 insertions, 10 deletions
diff --git a/distrib/compare/compare.hs b/distrib/compare/compare.hs
index 0e0e9f8306..0c6c4c4f39 100644
--- a/distrib/compare/compare.hs
+++ b/distrib/compare/compare.hs
@@ -16,13 +16,13 @@ import Tar
-- * Check installed trees too
-- * Check hashbangs
--- Only size changes > sizeAbs are considered an issue
-sizeAbs :: Integer
-sizeAbs = 1000
-
--- Only a size change of sizePercentage% or more is considered an issue
-sizePercentage :: Integer
-sizePercentage = 150
+sizeChangeThresholds :: [(Integer, -- Theshold only applies if one of
+ -- the files is at least this big
+ Integer)] -- Size changed if the larger file's
+ -- size is at least this %age of the
+ -- smaller file's size
+sizeChangeThresholds = [( 1000, 150),
+ (50 * 1000, 110)]
main :: IO ()
main = do args <- getArgs
@@ -260,9 +260,12 @@ compareTarLine tl1 tl2
perms2 = tlPermissions tl2
size1 = tlSize tl1
size2 = tlSize tl2
- sizeChanged = abs (size1 - size2) > sizeAbs
- && (((100 * size1) `div` size2) > sizePercentage ||
- ((100 * size2) `div` size1) > sizePercentage)
+ sizeMin = size1 `min` size2
+ sizeMax = size1 `max` size2
+ sizeChanged = any sizeChangeThresholdReached sizeChangeThresholds
+ sizeChangeThresholdReached (reqSize, percentage)
+ = (sizeMax >= reqSize)
+ && (((100 * sizeMax) `div` sizeMin) >= percentage)
versionRE :: String
versionRE = "([0-9]+(\\.[0-9]+)*)"