cabal-dev 0.8 → 0.9
raw patch · 9 files changed
+56/−15 lines, 9 filesdep ~Cabaldep ~prettydep ~processnew-uploader
Dependency ranges changed: Cabal, pretty, process
Files
- LICENSE +1/−1
- admin/cabal-config.in +1/−1
- cabal-dev.cabal +9/−7
- src/Distribution/Dev/AddSource.hs +1/−1
- src/Distribution/Dev/Flags.hs +1/−1
- src/Distribution/Dev/InvokeCabal.hs +2/−1
- src/Distribution/Dev/MergeCabalConfig.hs +39/−1
- src/Distribution/Dev/RewriteCabalConfig.hs +1/−1
- src/Main.hs +1/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c)2010, Galois, Inc.+Copyright (c)2011, Galois, Inc. All rights reserved.
admin/cabal-config.in view
@@ -49,7 +49,7 @@ -- preference: -- documentation: False -- doc-index-file: $datadir/doc/index.html--- root-cmd:+root-cmd: USE-DEFAULT -- symlink-bindir: build-summary: ./logs/build.log -- build-log:
cabal-dev.cabal view
@@ -1,5 +1,5 @@ Name: cabal-dev-Version: 0.8+Version: 0.9 Synopsis: Manage sandboxed Haskell build environments Description: cabal-dev is a tool for managing development builds of@@ -27,10 +27,11 @@ License: BSD3 License-file: LICENSE-Author: Josh Hoyt, Jonathan Daughtery, Rogan Creswick+Author: Josh Hoyt, Jonathan Daugherty, Rogan Creswick Maintainer: j3h@galois.com, jtd@galois.com, creswick@galois.com Homepage: https://github.com/creswick/cabal-dev-Copyright: 2010 Galois, Inc.+Bug-Reports: https://github.com/creswick/cabal-dev/issues+Copyright: 2011 Galois, Inc. Category: Development Build-type: Custom Cabal-version: >=1.6@@ -61,6 +62,7 @@ HS-Source-Dirs: src Main-is: Main.hs GHC-Options: -Wall+ Extensions: TemplateHaskell if flag(no-cabal-dev) Buildable: False@@ -92,12 +94,12 @@ bytestring >= 0.9 && < 0.10, directory >= 1.0 && < 1.3, filepath >= 1.1 && < 1.3,- Cabal >= 1.10.0.0 && < 1.11,+ Cabal >= 1.10.0.0 && < 1.13, HTTP >= 4000.0.9 && < 4000.2, mtl >= 1.1 && < 2.1, network >= 2.2 && < 2.4,- pretty >= 1.0 && < 1.1,- process >= 1.0 && < 1.1,+ pretty >= 1.0 && < 1.2,+ process >= 1.0 && < 1.2, tar >= 0.3 && < 0.4, zlib >= 0.5 && < 0.6, transformers >= 0.2 && < 0.3,@@ -137,7 +139,7 @@ Main-is: GhcPkgCompat.hs Build-Depends: base < 5,- Cabal >=1.2 && < 1.11+ Cabal >=1.2 && < 1.13 GHC-Options: -Wall HS-Source-Dirs: src
src/Distribution/Dev/AddSource.hs view
@@ -1,4 +1,4 @@-{- Copyright (c) 2010 Galois, Inc. -}+{- Copyright (c) 2011 Galois, Inc. -} {-| add-source command
src/Distribution/Dev/Flags.hs view
@@ -1,4 +1,4 @@-{- Copyright (c) 2010 Galois, Inc. -}+{- Copyright (c) 2011 Galois, Inc. -} {-# LANGUAGE CPP #-} module Distribution.Dev.Flags ( GlobalFlag(..)
src/Distribution/Dev/InvokeCabal.hs view
@@ -45,7 +45,7 @@ , sandbox ) import Distribution.Dev.Utilities ( ensureAbsolute )-import Distribution.Dev.MergeCabalConfig ( mergeFields )+import Distribution.Dev.MergeCabalConfig ( mergeFields, removeFlaggedFields ) actions :: CI.CabalCommand -> CommandActions actions cc = CommandActions@@ -101,6 +101,7 @@ let rew = R.Rewrite cabalHome (sandbox s) (pkgConf s) (CI.needsQuotes features) cOut = show $ R.ppTopLevel $ concat $ R.rewriteCabalConfig rew $+ removeFlaggedFields $ foldr (flip mergeFields) userFields (devFields:extraConfigs) writeUTF8File cfgOut cOut
src/Distribution/Dev/MergeCabalConfig.hs view
@@ -5,10 +5,14 @@ -} module Distribution.Dev.MergeCabalConfig ( mergeFields+ , isFlaggedForRemoval+ , filterFields+ , removeFlaggedFields ) where -import Data.Maybe ( fromMaybe )+import Data.Maybe ( fromMaybe, mapMaybe )+import Control.Monad ( guard ) import Control.Applicative ( Applicative, Alternative, pure, empty, (<|>), (<$>) ) import Distribution.ParseUtils ( Field(..) ) @@ -27,6 +31,40 @@ -- second argument) mergeFields = foldr $ \f fs -> fromMaybe (f:fs) $ replace (mergeField mergeFields f) fs++-- |Filter a configuration based on a predicate. Filters at the top+-- level as well as inside of Sections.+--+-- >>> let p f = case f of { F _ _ "bar" -> False; _ -> True; }+-- >>> filterFields p [F 0 "foo" "bar", Section 1 "quux" "beep" [], F 2 "arf" "baz"]+-- [Section 1 "quux" "beep" [], Field 2 "arf" "baz"]+filterFields :: (Field -> Bool) -> [Field] -> [Field]+filterFields p = mapMaybe $ \f -> guard (p f) >> return (recurseSection f)+ where+ recurseSection :: Field -> Field+ recurseSection (Section l n a fs) = Section l n a $ filterFields p fs+ recurseSection f = f++-- |Look for the magic value "USE-DEFAULT" as the value of a leaf+-- (Field). This means that there is no way to set a field to the+-- value "USE-DEFAULT" in a cabal configuration for use with+-- cabal-dev.+--+-- >>> isFlaggedForRemoval (F 0 "root-cmd" "sudo")+-- False+-- >>> isFlaggedForRemoval (F 0 "root-cmd" "USE-DEFAULT")+-- True+isFlaggedForRemoval :: Field -> Bool+isFlaggedForRemoval (F _ _ "USE-DEFAULT") = True+isFlaggedForRemoval _ = False++-- |Recursively remove all fields whose value is "USE-DEFAULT" from+-- the configuration.+--+-- >>> removeFlaggedFields [F 0 "foo" "USE-DEFAULT", Section 1 "quux" "beep" [], F 2 "arf" "baz"]+-- [Section 1 "quux" "beep" [], F 2 "arf" "baz"]+removeFlaggedFields :: [Field] -> [Field]+removeFlaggedFields = filterFields $ not . isFlaggedForRemoval -- |Attempt to merge two fields. --
src/Distribution/Dev/RewriteCabalConfig.hs view
@@ -1,4 +1,4 @@-{- Copyright (c) 2010 Galois, Inc. -}+{- Copyright (c) 2011 Galois, Inc. -} {-| Rewrite the paths of a cabal-install config file, canonicalizing them
src/Main.hs view
@@ -1,4 +1,4 @@-{- Copyright (c) 2010 Galois, Inc -}+{- Copyright (c) 2011 Galois, Inc -} module Main ( main ) where