packages feed

cabal-bounds 0.7 → 0.8

raw patch · 12 files changed

+388/−66 lines, 12 filesdep ~cabal-lensesdep ~lensPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: cabal-lenses, lens

API changes (from Hackage documentation)

+ CabalBounds.Args: Dump :: String -> [FilePath] -> Args
+ CabalBounds.Args: cabalFiles :: Args -> [FilePath]
+ CabalBounds.Args: defaultDump :: Args
+ CabalBounds.Args: fromFile :: Args -> FilePath
- CabalBounds.Args: Drop :: Bool -> Bool -> [String] -> [String] -> [String] -> [String] -> [String] -> String -> String -> Args
+ CabalBounds.Args: Drop :: Bool -> Bool -> [String] -> [String] -> [String] -> [String] -> [String] -> FilePath -> FilePath -> Args
- CabalBounds.Args: Update :: Bool -> Bool -> Maybe VersionComp -> Maybe VersionComp -> Bool -> [String] -> [String] -> [String] -> [String] -> [String] -> Bool -> String -> String -> String -> [String] -> Args
+ CabalBounds.Args: Update :: Bool -> Bool -> Maybe VersionComp -> Maybe VersionComp -> Bool -> [String] -> [String] -> [String] -> [String] -> [String] -> Bool -> FilePath -> FilePath -> String -> FilePath -> [FilePath] -> Args
- CabalBounds.Args: cabalFile :: Args -> String
+ CabalBounds.Args: cabalFile :: Args -> FilePath
- CabalBounds.Args: setupConfigFile :: Args -> [String]
+ CabalBounds.Args: setupConfigFile :: Args -> [FilePath]

Files

+ CHANGELOG view
@@ -0,0 +1,6 @@+0.8+---+* Add command 'cabal-bounds dump'+* Add option 'fromfile' to command 'cabal-bounds update'+* Support Haskell Platform 2014.2.0.0+* Bugfix for increasing the upper bounds version number
README.md view
@@ -69,6 +69,28 @@ If you specify a haskell platform release and a setup config file at once, then the setup config library verions are only used for the libraries not present in the haskell platform release. +Example: Update Bounds by File+==============================++It's also possible to update the bounds by library versions specified in a file:++    $> cabal-bounds update --fromfile=libs.hs myproject.cabal++The `libs.hs` file has to be of the format:++    [ ("libA", [0,2,1]), ("libB", [2,1]), ("libC", [1]) ]++If you specify a library file, a haskell platform release and a setup config file at once, then first the+haskell platform libraries and versions are considered, then the library file and at the end the setup+config file.++The library file can be created by the `dump` command:++    $> cabal-bounds dump --output=libs.hs myproject.cabal++The `dump` command will dump dependencies with their lower bound version. The command can take multiple cabal files.+If the same dependencies is present in multiple files, then the lowest lower bound version is taken.+ Example: Bound Changes ====================== 
cabal-bounds.cabal view
@@ -1,5 +1,5 @@ name: cabal-bounds-version: 0.7+version: 0.8 cabal-version: >=1.9.2 build-type: Simple license: BSD3@@ -17,17 +17,22 @@     .     * update them by the library versions of a haskell platform release     .+    * update them by the library versions specified by a file+    .     For further details please consult the <https://github.com/dan-t/cabal-bounds README>.-category: Utils Development+category: Utils, Development author: Daniel Trstenjak extra-source-files:     README.md+    CHANGELOG     tests/inputFiles/original.cabal+    tests/inputFiles/FromFile.hs     tests/inputFiles/setup-config     tests/inputFiles/setup-config-build-env/setup-config.cabal     tests/inputFiles/setup-config-build-env/src/*.hs     tests/inputFiles/setup-config-build-env/src/CabalBounds/*.hs     tests/goldenFiles/*.cabal+    tests/goldenFiles/*.hs     tests/outputFiles/.gitignore   source-repository head@@ -38,12 +43,12 @@     build-depends:         base >=3 && <5,         cmdargs >=0.10.5 && <0.11,-        lens >=4.0.1 && <4.3,+        lens >=4.0.1 && <4.4,         strict >=0.3.2 && <0.4,         unordered-containers >=0.2.3.3 && <0.3,         transformers >=0.3.0.0 && <0.5,         either >=4.1.1 && <4.4,-        cabal-lenses >=0.1 && <0.3,+        cabal-lenses ==0.3.*,         Cabal >=1.18.0 && <1.21     exposed-modules:         CabalBounds.Args@@ -60,6 +65,7 @@         CabalBounds.Dependencies         CabalBounds.Drop         CabalBounds.Update+        CabalBounds.Dump         CabalBounds.HaskellPlatform     ghc-options: -W  
lib/CabalBounds/Args.hs view
@@ -7,6 +7,7 @@    , outputFile    , defaultDrop    , defaultUpdate+   , defaultDump    ) where  import System.Console.CmdArgs hiding (ignore)@@ -24,8 +25,8 @@                  , benchmark  :: [String]                  , only       :: [String]                  , ignore     :: [String]-                 , output     :: String-                 , cabalFile  :: String+                 , output     :: FilePath+                 , cabalFile  :: FilePath                  }           | Update { lower           :: Bool                    , upper           :: Bool@@ -38,16 +39,20 @@                    , only            :: [String]                    , ignore          :: [String]                    , missing         :: Bool-                   , output          :: String+                   , output          :: FilePath+                   , fromFile        :: FilePath                    , haskellPlatform :: String-                   , cabalFile       :: String-                   , setupConfigFile :: [String]+                   , cabalFile       :: FilePath+                   , setupConfigFile :: [FilePath]                    }+          | Dump { output     :: String+                 , cabalFiles :: [FilePath]+                 }           deriving (Data, Typeable, Show, Eq)   get :: IO Args-get = cmdArgsRun . cmdArgsMode $ modes [dropArgs, updateArgs]+get = cmdArgsRun . cmdArgsMode $ modes [dropArgs, updateArgs, dumpArgs]    &= program "cabal-bounds"    &= summary summaryInfo    &= help "A command line program for managing the bounds/versions of the dependencies in a cabal file."@@ -59,8 +64,10 @@  outputFile :: Args -> FilePath outputFile args-   | null $ output args = cabalFile args-   | otherwise          = output args+   | not isDumpArgs && null (output args) = cabalFile args+   | otherwise                            = output args+   where+      isDumpArgs = case args of Dump {} -> True; _ -> False   defaultDrop :: Args@@ -91,35 +98,61 @@    , ignore          = def    , missing         = def    , output          = def+   , fromFile        = def    , haskellPlatform = def    , cabalFile       = def    , setupConfigFile = def    }  +defaultDump :: Args+defaultDump = Dump+   { output     = def+   , cabalFiles = def+   }++ dropArgs :: Args dropArgs = Drop-   { upper           = def &= explicit &= name "upper" &= name "U" &= help "Only the upper bound is dropped, otherwise both - the lower and upper - bounds are dropped."-   , library         = def &= explicit &= name "library" &= name "l" &= help "Only the bounds of the library are modified."-   , executable      = def &= typ "NAME" &= help "Only the bounds of the executable are modified."-   , testSuite       = def &= typ "NAME" &= help "Only the bounds of the test suite are modified."-   , benchmark       = def &= typ "NAME" &= help "Only the bounds of the benchmark are modified."-   , only            = def &= explicit &= typ "DEPENDENCY" &= name "only" &= name "O" &= help "Only the bounds of the dependency are modified."-   , ignore          = def &= explicit &= typ "DEPENDENCY" &= name "ignore" &= name "I" &= help "This dependency is ignored, not modified in any way."-   , output = def &= explicit &= typ "FILE" &= name "output" &= name "o" &= help "Save modified cabal file to file, if empty, the cabal file is modified inplace."-   , cabalFile       = def &= argPos 0 &= typ "CABAL-FILE"+   { upper      = def &= explicit &= name "upper" &= name "U"+                      &= help "Only the upper bound is dropped, otherwise both - the lower and upper - bounds are dropped."+   , library    = def &= explicit &= name "library" &= name "l" &= help "Only the bounds of the library are modified."+   , executable = def &= typ "NAME" &= help "Only the bounds of the executable are modified."+   , testSuite  = def &= typ "NAME" &= help "Only the bounds of the test suite are modified."+   , benchmark  = def &= typ "NAME" &= help "Only the bounds of the benchmark are modified."+   , only       = def &= explicit &= typ "DEPENDENCY" &= name "only" &= name "O"+                      &= help "Only the bounds of the dependency are modified."+   , ignore     = def &= explicit &= typ "DEPENDENCY" &= name "ignore" &= name "I"+                      &= help "This dependency is ignored, not modified in any way."+   , output     = def &= explicit &= typ "FILE" &= name "output" &= name "o"+                      &= help "Save modified cabal file to file, if empty, the cabal file is modified inplace."+   , cabalFile  = def &= argPos 0 &= typ "CABAL-FILE"    }   updateArgs :: Args updateArgs = Update-   { lower           = def &= explicit &= name "lower" &= name "L" &= help "Only the lower bound is updated. The same as using '--lowercomp=minor'."-   , upper           = def &= explicit &= name "upper" &= name "U" &= help "Only the upper bound is updated. The same as using '--uppercomp=major2'."-   , lowerComp       = def &= explicit &= name "lowercomp" &= help "Only the lower bound is updated with the specified version component. (major1, major2 or minor)"-   , upperComp       = def &= explicit &= name "uppercomp" &= help "Only the upper bound is updated with the specified version component. (major1, major2 or minor)"+   { lower           = def &= explicit &= name "lower" &= name "L"+                           &= help "Only the lower bound is updated. The same as using '--lowercomp=minor'."+   , upper           = def &= explicit &= name "upper" &= name "U"+                           &= help "Only the upper bound is updated. The same as using '--uppercomp=major2'."+   , lowerComp       = def &= explicit &= name "lowercomp"+                           &= help "Only the lower bound is updated with the specified version component. (major1, major2 or minor)"+   , upperComp       = def &= explicit &= name "uppercomp"+                           &= help "Only the upper bound is updated with the specified version component. (major1, major2 or minor)"    , missing         = def &= help "Only the dependencies having missing bounds are updated."-   , haskellPlatform = def &= explicit &= typ "VERSION" &= name "haskell-platform" &= help "Update bounds by the library versions of the specified haskell platform version"+   , fromFile        = def &= typ "FILE" &= help "Update bounds by the library versions spedified in the given file."+   , haskellPlatform = def &= explicit &= typ "VERSION" &= name "haskell-platform"+                           &= help "Update bounds by the library versions of the specified haskell platform version"    , setupConfigFile = def &= args &= typ "SETUP-CONFIG-FILE"+   }+++dumpArgs :: Args+dumpArgs = Dump+   { output     = def &= explicit &= typ "FILE" &= name "output" &= name "o"+                      &= help "Save libraries with lower bounds to file, if empty, then it's written to stdout."+   , cabalFiles = def &= args &= typ "CABAL_FILE"    }  
+ lib/CabalBounds/Dump.hs view
@@ -0,0 +1,34 @@++module CabalBounds.Dump+   ( dump+   ) where++import Distribution.PackageDescription (GenericPackageDescription)+import qualified Distribution.Version as V+import qualified Data.HashMap.Strict as HM+import Data.List (foldl')+import Data.Maybe (fromMaybe)+import qualified CabalLenses as CL+import Control.Lens++type LibName    = String+type LibVersion = [Int]+type Library    = (LibName, LibVersion)+++dump :: [GenericPackageDescription] -> [Library]+dump pkgDescrps = HM.toList $ foldl' addLibsFromPkgDescrp HM.empty pkgDescrps+   where+      addLibsFromPkgDescrp libs pkgDescrp = foldl' addLibFromDep libs (pkgDescrp ^.. CL.allDependency)++      addLibFromDep libs dep+         | depLowerBound /= CL.noLowerBound+         = HM.insertWith min depPkgName lowerVersionBranch libs++         | otherwise+         = libs+         where+            depPkgName = dep ^. CL.depPackageName . CL.pkgNameString++            depLowerBound@(V.LowerBound (V.Version { V.versionBranch = lowerVersionBranch }) _) =+               fromMaybe CL.noLowerBound (dep ^? CL.depVersionRange . CL.rangeToIntervals . _head . CL.lowerBound)
lib/CabalBounds/HaskellPlatform.hs view
@@ -42,6 +42,7 @@    , ("2012.2.0.0", libs_2012_2_0_0)    , ("2012.4.0.0", libs_2012_4_0_0)    , ("2013.2.0.0", libs_2013_2_0_0)+   , ("2014.2.0.0", libs_2014_2_0_0)    ]  @@ -331,17 +332,17 @@    , lib "Cabal" [1,16,0]    , lib "case-insensitive" [1,0,0,1]    , lib "cgi" [3001,1,7,5]-   , lib "containers" [0,4,2,1]-   , lib "deepseq" [1,3,0,0]+   , lib "containers" [0,5,0,0]+   , lib "deepseq" [1,3,0,1]    , lib "directory" [1,2,0,1]    , lib "fgl" [5,4,2,4]    , lib "filepath" [1,3,0,1]    , lib "GLUT" [2,4,0,0]-   , lib "GLUTRaw" [1,3,0,0]+   , lib "GLURaw" [1,3,0,0]    , lib "hashable" [1,1,2,5]    , lib "haskell-src" [1,0,1,5]    , lib "haskell2010" [1,1,1,0]-   , lib "haskell98" [2,0,0,1]+   , lib "haskell98" [2,0,0,2]    , lib "hpc" [0,6,0,0]    , lib "html" [1,0,1,2]    , lib "HTTP" [4000,2,8]@@ -373,6 +374,60 @@    , lib "unix" [2,6,0,1]    , lib "Win32" [2,3,0,0]    , lib "vector" [0,10,0,1]+   , lib "xhtml" [3000,2,1]+   , lib "zlib" [0,5,4,1]+   ]+++libs_2014_2_0_0 =+   [ lib "array" [0,5,0,0]+   , lib "async" [2,0,1,5]+   , lib "attoparsec" [0,10,4,0]+   , lib "base" [4,7,0,1]+   , lib "bytestring" [0,10,4,0]+   , lib "Cabal" [1,18,1,3]+   , lib "case-insensitive" [1,1,0,3]+   , lib "containers" [0,5,5,1]+   , lib "deepseq" [1,3,0,2]+   , lib "directory" [1,2,1,0]+   , lib "fgl" [5,5,0,1]+   , lib "filepath" [1,3,0,2]+   , lib "GLUT" [2,5,1,1]+   , lib "GLURaw" [1,4,0,1]+   , lib "hashable" [1,2,2,0]+   , lib "haskell-src" [1,0,1,6]+   , lib "haskell2010" [1,1,2,0]+   , lib "haskell98" [2,0,0,3]+   , lib "hpc" [0,6,0,1]+   , lib "html" [1,0,1,2]+   , lib "HTTP" [4000,2,10]+   , lib "HUnit" [1,2,5,2]+   , lib "mtl" [2,1,3,1]+   , lib "network" [2,4,2,3]+   , lib "old-locale" [1,0,0,6]+   , lib "old-time" [1,1,0,2]+   , lib "OpenGL" [2,9,2,0]+   , lib "OpenGLRaw" [1,5,0,0]+   , lib "parallel" [3,2,0,4]+   , lib "parsec" [3,1,5]+   , lib "pretty" [1,1,1,1]+   , lib "primitive" [0,5,2,1]+   , lib "process" [1,2,0,0]+   , lib "QuickCheck" [2,6]+   , lib "random" [1,0,1,1]+   , lib "regex-base" [0,93,2]+   , lib "regex-compat" [0,95,1]+   , lib "regex-posix" [0,95,2]+   , lib "split" [0,2,2]+   , lib "stm" [2,4,2]+   , lib "syb" [0,4,1]+   , lib "template-haskell" [2,9,0,0]+   , lib "text" [1,1,0,0]+   , lib "time" [1,4,2]+   , lib "transformers" [0,3,0,0]+   , lib "unordered-containers" [0,2,4,0]+   , lib "unix" [2,7,0,1]+   , lib "vector" [0,10,9,1]    , lib "xhtml" [3000,2,1]    , lib "zlib" [0,5,4,1]    ]
lib/CabalBounds/Main.hs view
@@ -20,12 +20,16 @@ import qualified CabalBounds.Dependencies as DP import qualified CabalBounds.Drop as D import qualified CabalBounds.Update as U+import qualified CabalBounds.Dump as D import qualified CabalBounds.HaskellPlatform as HP import qualified System.IO.Strict as SIO import Control.Applicative ((<$>)) import Control.Monad.Trans.Either (EitherT, runEitherT, bimapEitherT, hoistEither, left, right) import Control.Monad.IO.Class import qualified Data.HashMap.Strict as HM+import Data.List (foldl', sortBy)+import Data.Function (on)+import Data.Char (toLower)  type Error = String @@ -39,7 +43,7 @@ cabalBounds args@A.Update {} =    leftToJust <$> runEitherT (do       pkgDescrp <- packageDescription $ A.cabalFile args-      libs      <- libraries setupConfigFile (A.haskellPlatform args)+      libs      <- libraries (A.haskellPlatform args) (A.fromFile args) setupConfigFile       let pkgDescrp' = U.update (B.boundOfUpdate args) (S.sections args pkgDescrp) (DP.dependencies args) libs pkgDescrp       liftIO $ writeFile (A.outputFile args) (showGenericPackageDescription pkgDescrp'))    where@@ -50,7 +54,19 @@          | otherwise          = "" +cabalBounds args@A.Dump {} =+   leftToJust <$> runEitherT (do+      pkgDescrps <- packageDescriptions $ A.cabalFiles args+      let libs = sortBy (compare `on` (map toLower . fst)) $ D.dump pkgDescrps+      if (not . null . A.outputFile $ args)+         then liftIO $ writeFile (A.outputFile args) (prettyPrint libs)+         else liftIO $ putStrLn (prettyPrint libs))+   where+      prettyPrint []     = "[]"+      prettyPrint (l:ls) =+         "[ " ++ show l ++ "\n" ++ foldl' (\str l -> str ++ ", " ++ show l ++ "\n") "" ls ++ "]"; + packageDescription :: FilePath -> EitherT Error IO GenericPackageDescription packageDescription file = do    contents <- liftIO $ SIO.readFile file@@ -59,21 +75,41 @@         ParseOk _ pkgDescrp -> right pkgDescrp  +packageDescriptions :: [FilePath] -> EitherT Error IO [GenericPackageDescription]+packageDescriptions []    = left "Missing cabal file"+packageDescriptions files = mapM packageDescription files++ type SetupConfigFile = String+type LibraryFile     = String -libraries :: SetupConfigFile -> HP.HPVersion -> EitherT Error IO U.Libraries-libraries "" ""              = left "Missing setup config file and haskell platform version"-libraries confFile ""        = installedLibraries confFile-libraries "" hpVersion       = haskellPlatformLibraries hpVersion-libraries confFile hpVersion = do-   instLibs <- installedLibraries confFile-   hpLibs   <- haskellPlatformLibraries hpVersion-   right $ HM.union hpLibs instLibs+libraries :: HP.HPVersion -> LibraryFile -> SetupConfigFile -> EitherT Error IO U.Libraries+libraries "" "" ""                   = left "Missing library file, haskell platform version and setup config file"+libraries hpVersion libFile confFile = do+   hpLibs       <- haskellPlatformLibraries hpVersion+   libsFromFile <- librariesFromFile libFile+   instLibs     <- installedLibraries confFile+   right $ HM.union (HM.union hpLibs libsFromFile) instLibs  +librariesFromFile :: LibraryFile -> EitherT Error IO U.Libraries+librariesFromFile ""      = right HM.empty+librariesFromFile libFile = do+   contents <- liftIO $ SIO.readFile libFile+   libsFrom contents+   where+      libsFrom contents+         | [(libs, _)] <- reads contents :: [([(String, [Int])], String)]+         = right $ HM.fromList (map (\(pkgName, versBranch) -> (pkgName, V.Version versBranch [])) libs)++         | otherwise+         = left "Invalid format of library file given to '--fromfile'. Expected file with content of type '[(String, [Int])]'."++ haskellPlatformLibraries :: HP.HPVersion -> EitherT Error IO U.Libraries haskellPlatformLibraries hpVersion =    case hpVersion of+        ""         -> right HM.empty         "current"  -> right . HM.fromList $ HP.currentLibraries         "previous" -> right . HM.fromList $ HP.previousLibraries         version | Just libs <- HP.librariesOf version -> right . HM.fromList $ libs@@ -81,6 +117,7 @@   installedLibraries :: SetupConfigFile -> EitherT Error IO U.Libraries+installedLibraries ""       = right HM.empty installedLibraries confFile = do    binfo <- liftIO $ tryGetConfigStateFile confFile    bimapEitherT show buildInfoLibs (hoistEither binfo)
lib/CabalBounds/Update.hs view
@@ -36,7 +36,7 @@ updateDependency :: UpdateBound -> Libraries -> P.Dependency -> P.Dependency updateDependency (UpdateLower comp ifMissing) libs dep =    fromMaybe dep $-      if ifMissing && lowerBound_ /= noLowerBound+      if ifMissing && lowerBound_ /= CL.noLowerBound          then return dep          else do             version <- HM.lookup pkgName_ libs@@ -47,11 +47,11 @@             return $ mkDependency pkgName_ vrange    where       updateLower newLowerBound []        = [(newLowerBound, V.NoUpperBound)]-      updateLower newLowerBound intervals = intervals & _head . lowerBound .~ newLowerBound+      updateLower newLowerBound intervals = intervals & _head . CL.lowerBound .~ newLowerBound        pkgName_      = pkgName dep       versionRange_ = versionRange dep-      lowerBound_   = fromMaybe noLowerBound $ V.asVersionIntervals versionRange_ ^? _head . lowerBound+      lowerBound_   = fromMaybe CL.noLowerBound $ V.asVersionIntervals versionRange_ ^? _head . CL.lowerBound  updateDependency (UpdateUpper comp ifMissing) libs dep =    fromMaybe dep $@@ -66,10 +66,10 @@    where       versionRange_ = versionRange dep       pkgName_      = pkgName dep-      upperBound_   = fromMaybe V.NoUpperBound $ V.asVersionIntervals versionRange_ ^? _head . upperBound+      upperBound_   = fromMaybe V.NoUpperBound $ V.asVersionIntervals versionRange_ ^? _head . CL.upperBound -      updateUpper newUpperBound []        = [(noLowerBound, newUpperBound)]-      updateUpper newUpperBound intervals = intervals & _last . upperBound .~ newUpperBound+      updateUpper newUpperBound []        = [(CL.noLowerBound, newUpperBound)]+      updateUpper newUpperBound intervals = intervals & _last . CL.upperBound .~ newUpperBound  updateDependency (UpdateBoth lowerComp upperComp ifMissing) libs dep =     updateDependency (UpdateLower lowerComp ifMissing) libs $@@ -82,17 +82,31 @@  compOf :: VersionComp -> V.Version -> V.Version Major1 `compOf` version =-   version & CL.versionBranchL %~ take 1+   version & CL.versionBranchL %~ (take 1 . ensureMinimalVersionBranch Major1)            & CL.versionTagsL   .~ []  Major2 `compOf` version =-   version & CL.versionBranchL %~ take 2+   version & CL.versionBranchL %~ (take 2 . ensureMinimalVersionBranch Major2)            & CL.versionTagsL   .~ []  Minor `compOf` version =-   version & CL.versionTagsL .~ []+   version & CL.versionBranchL %~ ensureMinimalVersionBranch Minor+           & CL.versionTagsL   .~ []  +ensureMinimalVersionBranch :: VersionComp -> [Int] -> [Int]+ensureMinimalVersionBranch comp branch =+   let numDigits  = numNeededVersionDigits comp+       numMissing = numDigits - length branch+       branch' | numMissing >= 0 = branch ++ replicate numMissing 0+               | otherwise       = branch+       in branch'+   where+      numNeededVersionDigits Major1 = 1+      numNeededVersionDigits Major2 = 2+      numNeededVersionDigits Minor  = 3++ nextVersion :: V.Version -> V.Version nextVersion version =    version & CL.versionBranchL %~ increaseLastComp@@ -110,15 +124,3 @@  mkDependency :: PkgName -> V.VersionRange -> P.Dependency mkDependency name = P.Dependency (P.PackageName name)---lowerBound :: Lens' V.VersionInterval V.LowerBound-lowerBound = _1---upperBound :: Lens' V.VersionInterval V.UpperBound-upperBound = _2---noLowerBound :: V.LowerBound-noLowerBound = V.LowerBound (V.Version [0] []) V.InclusiveBound
tests/Main.hs view
@@ -61,16 +61,18 @@    , test "UpdateBothIgnoreBase" $ defaultUpdate { ignore = ["base"] }    , test "UpdateLowerIgnoreBase" $ defaultUpdate { lower = True, ignore = ["base"] }    , test "UpdateMinorLower" $ defaultUpdate { lowerComp = Just Minor }-   , test "UpdateMajor2Lower" $ defaultUpdate {lowerComp = Just Major2 }-   , test "UpdateMajor1Lower" $ defaultUpdate {lowerComp = Just Major1 }+   , test "UpdateMajor2Lower" $ defaultUpdate { lowerComp = Just Major2 }+   , test "UpdateMajor1Lower" $ defaultUpdate { lowerComp = Just Major1 }    , test "UpdateMinorUpper" $ defaultUpdate { upperComp = Just Minor }-   , test "UpdateMajor2Upper" $ defaultUpdate {upperComp = Just Major2 }-   , test "UpdateMajor1Upper" $ defaultUpdate {upperComp = Just Major1 }+   , test "UpdateMajor2Upper" $ defaultUpdate { upperComp = Just Major2 }+   , test "UpdateMajor1Upper" $ defaultUpdate { upperComp = Just Major1 }    , test "UpdateMinorLowerAndUpper" $ defaultUpdate { lowerComp = Just Minor, upperComp = Just Minor }    , test "UpdateMajor1LowerAndUpper" $ defaultUpdate { lowerComp = Just Major1, upperComp = Just Major1 }    , test "UpdateOnlyMissing" $ defaultUpdate { missing = True }    , testWithoutSetupConfig "UpdateByHaskellPlatform" $ defaultUpdate { haskellPlatform = "2013.2.0.0" }    , test "UpdateByHaskellPlatformAndSetupConfig" $ defaultUpdate { haskellPlatform = "2013.2.0.0" }+   , testWithoutSetupConfig "FromFile" $ defaultUpdate { upper = True, fromFile = "tests" </> "inputFiles" </> "FromFile.hs" }+   , testWithoutSetupConfig "Dump" $ defaultDump    ]  @@ -102,8 +104,13 @@                                 , setupConfigFile = [setupConfigFile | withSetupConfig]                                 } +              Dump {}   -> args { cabalFiles = [inputFile]+                                , output     = outputFile+                                }+       diff ref new    = ["diff", "-u", ref, new]-      goldenFile      = "tests" </> "goldenFiles" </> testName <.> "cabal"-      outputFile      = "tests" </> "outputFiles" </> testName <.> "cabal"+      goldenFile      = "tests" </> "goldenFiles" </> testName <.> (if isDumpTest then "hs" else "cabal")+      outputFile      = "tests" </> "outputFiles" </> testName <.> (if isDumpTest then "hs" else "cabal")       inputFile       = "tests" </> "inputFiles"  </> "original.cabal"       setupConfigFile = "tests" </> "inputFiles"  </> "setup-config"+      isDumpTest      = case args of Dump {} -> True; _ -> False
+ tests/goldenFiles/Dump.hs view
@@ -0,0 +1,3 @@+[ ("base",[3])+, ("cmdargs",[0,10,5])+]
+ tests/goldenFiles/FromFile.cabal view
@@ -0,0 +1,114 @@+name: cabal-bounds+version: 0.1+cabal-version: >=1.9.2+build-type: Simple+license: AllRightsReserved+maintainer: daniel.trstenjak@gmail.com+synopsis: A command line program for managing the bounds/versions of the dependencies in a cabal file.+description:+    A command line program for managing the bounds/versions of the dependencies in a cabal file.+category: Utils+author: Daniel Trstenjak+ +source-repository head+    type: git+    location: https://github.com/dan-t/cabal-bounds+ +library+    build-depends:+        base >=3 && <5,+        cmdargs >=0.10.5 && <2.3,+        lens <5.1,+        pretty-show -any,+        strict -any,+        Cabal -any+    exposed-modules:+        CabalBounds.Args+        CabalBounds.Command+        CabalBounds.Execute+        CabalBounds.Lenses+    exposed: True+    buildable: True+    hs-source-dirs: src+    other-modules:+        Paths_cabal_bounds+ +executable cabal-bounds+    build-depends:+        base >=3 && <5,+        cmdargs >=0.10.5 && <2.3,+        lens <5.1,+        pretty-show -any,+        strict -any,+        Cabal -any+    main-is: ExeMain1.hs+    buildable: True+    cpp-options: -DCABAL+    hs-source-dirs: src+    other-modules:+        Paths_cabal_bounds+        CabalBounds.Args+        CabalBounds.Command+        CabalBounds.Execute+        CabalBounds.Lenses+    ghc-options: -W+ +executable other-exe+    build-depends:+        base >=3 && <5,+        cmdargs >=0.10.5 && <2.3,+        lens <5.1,+        pretty-show -any,+        strict -any,+        Cabal -any+    main-is: ExeMain2.hs+    buildable: True+    cpp-options: -DCABAL+    hs-source-dirs: src+    other-modules:+        Paths_cabal_bounds+        CabalBounds.Args+        CabalBounds.Command+        CabalBounds.Execute+        CabalBounds.Lenses+    ghc-options: -W+ +test-suite some-test+    build-depends:+        base >=3 && <5,+        cmdargs >=0.10.5 && <2.3,+        lens <5.1,+        pretty-show -any,+        strict -any,+        Cabal -any+    type: exitcode-stdio-1.0+    main-is: TestMain1.hs+    buildable: True+    hs-source-dirs: src+    other-modules:+        Paths_cabal_bounds+        CabalBounds.Args+        CabalBounds.Command+        CabalBounds.Execute+        CabalBounds.Lenses+    ghc-options: -W+test-suite other-test+    build-depends:+        base >=3 && <5,+        cmdargs >=0.10.5 && <2.3,+        lens <5.1,+        pretty-show -any,+        strict -any,+        Cabal -any+    type: exitcode-stdio-1.0+    main-is: TestMain2.hs+    buildable: True+    hs-source-dirs: src+    other-modules:+        Paths_cabal_bounds+        CabalBounds.Args+        CabalBounds.Command+        CabalBounds.Execute+        CabalBounds.Lenses+    ghc-options: -W+ 
+ tests/inputFiles/FromFile.hs view
@@ -0,0 +1,3 @@+[ ("cmdargs", [2,2])+, ("lens", [5])+]