Permalink
Browse files

Updates for ghc-7.4.1 - bumped version bounds, cleaned up a test

  • Loading branch information...
1 parent d631dff commit e17a119dda066cc2dcde092019ff259830554444 @creswick committed Feb 7, 2012
Showing with 7 additions and 100 deletions.
  1. +3 −30 Setup.hs
  2. +4 −10 cabal-dev.cabal
  3. +0 −60 test/RunTests.hs
View
33 Setup.hs
@@ -12,37 +12,10 @@ import System.Directory ( doesDirectoryExist )
import System.FilePath ( (</>) )
main = defaultMainWithHooks $
- simpleUserHooks { buildHook = getCabalInstallSource
- , hookedPrograms = [cabalInstallProgram] }
-
+ simpleUserHooks { hookedPrograms = [cabalInstallProgram]
+ }
cabalInstallProgram :: Program
cabalInstallProgram = (simpleProgram "cabal") {
programFindVersion = findProgramVersion "--numeric-version" id
- }
-
-getCabalInstallSource :: PackageDescription -> LocalBuildInfo -> UserHooks
- -> BuildFlags -> IO ()
-getCabalInstallSource pkgDesc lbi hooks flags =
- do -- cabal-install fails (exit 1) if the target unpack dir exists.
- exists <- doesDirectoryExist cabalInstallDir
- unless exists $ rawSystemExit v unpackCommand args
- buildHook simpleUserHooks updatedSrcDesc lbi hooks flags
- where v = buildVerbose flags
- unpackCommand = "cabal"
- srcDir = buildDir lbi
- cabalInstallName = "cabal-install-0.8.2"
- cabalInstallCabal = "cabal-install.cabal"
- cabalInstallDir = srcDir </> cabalInstallName
- args = ["unpack", "--dest="++srcDir, cabalInstallName]
- updatedSrcDesc = addSrcDirs pkgDesc cabalInstallDir
-
-addSrcDirs :: PackageDescription -> FilePath -> PackageDescription
-addSrcDirs pkgDesc path =
- let notTargetTestExe exe = exeName exe /= "cabal-dev-test"
- updateExe exe | notTargetTestExe exe = id exe
- | otherwise = updateSrcDirs exe
- updateSrcDirs exe = exe {
- buildInfo = (buildInfo exe) {
- hsSourceDirs = (hsSourceDirs $ buildInfo exe) ++ [path] }}
- in pkgDesc { executables = map updateExe $ executables pkgDesc }
+ }
View
14 cabal-dev.cabal
@@ -1,5 +1,5 @@
Name: cabal-dev
-Version: 0.9
+Version: 0.9.1
Synopsis: Manage sandboxed Haskell build environments
Description: cabal-dev is a tool for managing development builds of
@@ -38,7 +38,7 @@ Cabal-version: >=1.6
Data-Files:
admin/cabal-config.in,
admin/00-index.tar
-Tested-with: GHC == 6.12.3, GHC == 6.10.4, GHC == 7.0.3
+Tested-with: GHC == 6.12.3, GHC == 6.10.4, GHC == 7.0.3, GHC == 7.4.1
source-repository head
type: git
@@ -161,15 +161,9 @@ Executable cabal-dev-test
Build-depends:
MonadRandom >= 0.1 && < 0.2,
random >= 1 && < 1.1,
- test-framework >= 0.3 && < 0.5,
+ test-framework >= 0.3 && < 0.6,
test-framework-hunit >= 0.2,
- HUnit >= 1.2 && <2,
--- These dependencies are needed for the cabal-install
--- code that is pulled in automatically by the userhooks
- containers >= 0.1 && < 0.5,
- network >= 1 && < 3,
- array >= 0.1 && < 0.5,
- pretty >= 1 && < 1.2
+ HUnit >= 1.2 && <2
if os(windows)
build-depends: Win32 >= 2.1 && < 2.3
View
60 test/RunTests.hs
@@ -42,9 +42,6 @@ import Test.Framework ( defaultMainWithArgs, Test, testGroup )
import Test.Framework.Providers.HUnit ( testCase )
import Test.HUnit ( (@?=) )
import qualified Test.HUnit as HUnit
-
-import Distribution.Client.Config -- ( parseConfig )
-import Distribution.Client.Setup ( GlobalFlags(..) )
import Distribution.Simple.InstallDirs
import Distribution.Simple.Setup
import Distribution.ParseUtils
@@ -64,13 +61,6 @@ tests v p =
, testCase "Index tar files contain all contents" $
assertTarFileOk v p
]
- , testGroup "Parsing and serializing" $
- [ testCase "simple round-trip test" $
- assertRoundTrip
-
- -- , testCase "sample echo test" $
- -- configEcho
- ]
]
testBasicInvocation :: FilePath -> [Test]
@@ -104,56 +94,6 @@ main = do
defaultMainWithArgs (tests normal cabalDev) testFrameworkArgs
--- |Test that parsing and serializing a cabal-install SavedConfig with
--- spaces in the paths preserves the spaces properly.
---
--- This tests only a select few of the fields and leaves the rest
--- empty. In practice, this has proven to be adequate.
---
--- This is really just testing that cabal-install is capable of
--- handling these fields. We have baked in knowledge of the syntax
--- that these fields need into RewriteCabalConfig. Ideally,
--- RewriteCabalConfig would read/write the data structure using the
--- code from cabal-install. We haven't done that because pulling in
--- all of the code from cabal-install into a production build is
--- pretty hackish. I think that cabal-dev ought to be a fork or
--- alternate build of cabal-install.
---
--- Note that this test is the whole reason that we have the custom
--- build type.
-assertRoundTrip :: HUnit.Assertion
-assertRoundTrip =
- do parsed <- case parseConfig mempty $ showConfig configWithSpaces of
- ParseFailed err -> fail $ "Parse failed: " ++ show err
- ParseOk _ val -> return val
-
- let check msg f =
- (HUnit.assertEqual msg `on` f) parsed configWithSpaces
-
- check "globalLocalRepos" (globalLocalRepos . savedGlobalFlags)
- check "cache" (globalCacheDir . savedGlobalFlags)
- check "prefix" (show . prefix . savedUserInstallDirs)
- check "bindir" (show . bindir . savedUserInstallDirs)
- check "packageDB" (configPackageDB . savedConfigureFlags)
- where
- configWithSpaces =
- mempty { savedGlobalFlags =
- mempty { globalLocalRepos = [pfx "repos"]
- , globalCacheDir = toFlag $ pfx "cache"
- }
- , savedUserInstallDirs =
- mempty { prefix = toFlag $ toPathTemplate $ pfx ""
- , bindir = toFlag $ toPathTemplate $ pfx "binaries"
- }
- , savedConfigureFlags =
- mempty { configPackageDB =
- toFlag $ SpecificPackageDB $ pfx "package.db"
- }
- }
-
- pfx = ("/path with spaces" </>)
-
-
assertProgramOutput :: (String -> Bool) -> FilePath -> [String]
-> HUnit.Assertion
assertProgramOutput f = assertProgram "has proper output" $

0 comments on commit e17a119

Please sign in to comment.