summaryrefslogtreecommitdiff
path: root/utils/compare_sizes
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-12-16 16:56:08 +0000
committerIan Lynagh <igloo@earth.li>2009-12-16 16:56:08 +0000
commit8e63e8eae43292fbeb219740eadd798bde76760c (patch)
tree693a5a421f40bc3e4cae19763220b14b963d2a74 /utils/compare_sizes
parent76dfa3944cbf149a30398d29e6762a44772c0174 (diff)
downloadhaskell-8e63e8eae43292fbeb219740eadd798bde76760c.tar.gz
Build and install inplace the count_lines and compareSizes utils
Diffstat (limited to 'utils/compare_sizes')
-rw-r--r--utils/compare_sizes/LICENSE31
-rw-r--r--utils/compare_sizes/Main.hs (renamed from utils/compare_sizes/compareSizes.hs)6
-rw-r--r--utils/compare_sizes/compareSizes.cabal19
-rw-r--r--utils/compare_sizes/ghc.mk8
4 files changed, 63 insertions, 1 deletions
diff --git a/utils/compare_sizes/LICENSE b/utils/compare_sizes/LICENSE
new file mode 100644
index 0000000000..b5059b71f6
--- /dev/null
+++ b/utils/compare_sizes/LICENSE
@@ -0,0 +1,31 @@
+The Glasgow Haskell Compiler License
+
+Copyright 2002, The University Court of the University of Glasgow.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+- Neither name of the University nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
+GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/utils/compare_sizes/compareSizes.hs b/utils/compare_sizes/Main.hs
index a0397bf2fa..302efafb22 100644
--- a/utils/compare_sizes/compareSizes.hs
+++ b/utils/compare_sizes/Main.hs
@@ -89,7 +89,8 @@ getTree isFileInteresting root dir subdir
dir' = dir <//> subdir
doEntry :: FilePath -> IO (Maybe Tree)
doEntry e = liftM Just (getTree isFileInteresting root dir' e)
- `catch` \_ -> -- XXX Do this better
+ `catchIO` \_ -> -- XXX We ought to check this is a
+ -- "not a directory" exception really
if isFileInteresting e
then do let fn = dir' <//> e
h <- openFile (root </> fn) ReadMode
@@ -98,6 +99,9 @@ getTree isFileInteresting root dir subdir
return $ Just $ File e fn size
else return Nothing
+catchIO :: IO a -> (IOError -> IO a) -> IO a
+catchIO = catch
+
----------------------------------------------------------------------
-- Comparing the trees
diff --git a/utils/compare_sizes/compareSizes.cabal b/utils/compare_sizes/compareSizes.cabal
new file mode 100644
index 0000000000..32acb1d6e7
--- /dev/null
+++ b/utils/compare_sizes/compareSizes.cabal
@@ -0,0 +1,19 @@
+name: compareSizes
+version: 0.1.0.0
+cabal-version: >= 1.6
+license: BSD3
+build-type: Simple
+license-file: LICENSE
+stability: experimental
+synopsis: Size comparison util
+description: Size comparison util
+category: Development
+
+executable compareSizes
+ build-depends:
+ base >= 4 && < 5,
+ directory,
+ filepath
+
+ main-is: Main.hs
+
diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk
new file mode 100644
index 0000000000..1c9dbee4a9
--- /dev/null
+++ b/utils/compare_sizes/ghc.mk
@@ -0,0 +1,8 @@
+
+utils/compare_sizes_USES_CABAL = YES
+utils/compare_sizes_PACKAGE = compareSizes
+utils/compare_sizes_MODULES = Main
+utils/compare_sizes_dist_PROG = compareSizes$(exeext)
+
+$(eval $(call build-prog,utils/compare_sizes,dist,1))
+