Skip to content
This repository
Browse code

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

  • Loading branch information...
commit e17a119dda066cc2dcde092019ff259830554444 1 parent d631dff
Rogan Creswick authored February 07, 2012
33  Setup.hs
@@ -12,37 +12,10 @@ import System.Directory ( doesDirectoryExist )
12 12
 import System.FilePath ( (</>) )
13 13
 
14 14
 main = defaultMainWithHooks $
15  
-       simpleUserHooks { buildHook = getCabalInstallSource
16  
-                       , hookedPrograms = [cabalInstallProgram] }
17  
-
  15
+       simpleUserHooks { hookedPrograms = [cabalInstallProgram]
  16
+                       }
18 17
 
19 18
 cabalInstallProgram :: Program
20 19
 cabalInstallProgram = (simpleProgram "cabal") {
21 20
   programFindVersion = findProgramVersion "--numeric-version" id
22  
-  }
23  
-
24  
-getCabalInstallSource :: PackageDescription -> LocalBuildInfo -> UserHooks
25  
-                      -> BuildFlags -> IO ()
26  
-getCabalInstallSource pkgDesc lbi hooks flags =
27  
-  do -- cabal-install fails (exit 1) if the target unpack dir exists.
28  
-    exists <- doesDirectoryExist cabalInstallDir
29  
-    unless exists $ rawSystemExit v unpackCommand args
30  
-    buildHook simpleUserHooks updatedSrcDesc lbi hooks flags
31  
-  where v = buildVerbose flags
32  
-        unpackCommand = "cabal"
33  
-        srcDir        = buildDir lbi
34  
-        cabalInstallName  = "cabal-install-0.8.2"
35  
-        cabalInstallCabal = "cabal-install.cabal"
36  
-        cabalInstallDir   = srcDir </> cabalInstallName
37  
-        args            = ["unpack", "--dest="++srcDir, cabalInstallName]
38  
-        updatedSrcDesc  = addSrcDirs pkgDesc cabalInstallDir
39  
-
40  
-addSrcDirs :: PackageDescription -> FilePath -> PackageDescription
41  
-addSrcDirs pkgDesc path =
42  
-  let notTargetTestExe exe = exeName exe /= "cabal-dev-test"
43  
-      updateExe exe | notTargetTestExe exe = id exe
44  
-                    | otherwise            = updateSrcDirs exe
45  
-      updateSrcDirs exe = exe {
46  
-          buildInfo = (buildInfo exe) {
47  
-             hsSourceDirs = (hsSourceDirs $ buildInfo exe) ++ [path] }}
48  
-  in pkgDesc { executables = map updateExe $ executables pkgDesc }
  21
+  }
14  cabal-dev.cabal
... ...
@@ -1,5 +1,5 @@
1 1
 Name:                cabal-dev
2  
-Version:             0.9
  2
+Version:             0.9.1
3 3
 Synopsis:            Manage sandboxed Haskell build environments
4 4
 
5 5
 Description:         cabal-dev is a tool for managing development builds of
@@ -38,7 +38,7 @@ Cabal-version:       >=1.6
38 38
 Data-Files:
39 39
   admin/cabal-config.in,
40 40
   admin/00-index.tar
41  
-Tested-with: GHC == 6.12.3, GHC == 6.10.4, GHC == 7.0.3
  41
+Tested-with: GHC == 6.12.3, GHC == 6.10.4, GHC == 7.0.3, GHC == 7.4.1
42 42
 
43 43
 source-repository head
44 44
   type:        git
@@ -161,15 +161,9 @@ Executable cabal-dev-test
161 161
     Build-depends:
162 162
       MonadRandom >= 0.1 && < 0.2,
163 163
       random >= 1 && < 1.1,
164  
-      test-framework >= 0.3 && < 0.5,
  164
+      test-framework >= 0.3 && < 0.6,
165 165
       test-framework-hunit >= 0.2,
166  
-      HUnit >= 1.2 && <2,
167  
--- These dependencies are needed for the cabal-install
168  
--- code that is pulled in automatically by the userhooks
169  
-      containers >= 0.1 && < 0.5,
170  
-      network  >= 1        && < 3,
171  
-      array      >= 0.1 && < 0.5,
172  
-      pretty     >= 1   && < 1.2
  166
+      HUnit >= 1.2 && <2
173 167
 
174 168
   if os(windows)
175 169
      build-depends: Win32 >= 2.1  && < 2.3
60  test/RunTests.hs
@@ -42,9 +42,6 @@ import Test.Framework ( defaultMainWithArgs, Test, testGroup )
42 42
 import Test.Framework.Providers.HUnit ( testCase )
43 43
 import Test.HUnit ( (@?=) )
44 44
 import qualified Test.HUnit as HUnit
45  
-
46  
-import Distribution.Client.Config -- ( parseConfig )
47  
-import Distribution.Client.Setup ( GlobalFlags(..) )
48 45
 import Distribution.Simple.InstallDirs
49 46
 import Distribution.Simple.Setup
50 47
 import Distribution.ParseUtils
@@ -64,13 +61,6 @@ tests v p =
64 61
       , testCase "Index tar files contain all contents" $
65 62
         assertTarFileOk v p
66 63
       ]
67  
-    , testGroup "Parsing and serializing" $
68  
-      [ testCase "simple round-trip test" $
69  
-        assertRoundTrip
70  
-
71  
-      -- , testCase "sample echo test" $
72  
-      --   configEcho
73  
-      ]
74 64
     ]
75 65
 
76 66
 testBasicInvocation :: FilePath -> [Test]
@@ -104,56 +94,6 @@ main = do
104 94
 
105 95
   defaultMainWithArgs (tests normal cabalDev) testFrameworkArgs
106 96
 
107  
--- |Test that parsing and serializing a cabal-install SavedConfig with
108  
--- spaces in the paths preserves the spaces properly.
109  
---
110  
--- This tests only a select few of the fields and leaves the rest
111  
--- empty. In practice, this has proven to be adequate.
112  
---
113  
--- This is really just testing that cabal-install is capable of
114  
--- handling these fields. We have baked in knowledge of the syntax
115  
--- that these fields need into RewriteCabalConfig. Ideally,
116  
--- RewriteCabalConfig would read/write the data structure using the
117  
--- code from cabal-install. We haven't done that because pulling in
118  
--- all of the code from cabal-install into a production build is
119  
--- pretty hackish. I think that cabal-dev ought to be a fork or
120  
--- alternate build of cabal-install.
121  
---
122  
--- Note that this test is the whole reason that we have the custom
123  
--- build type.
124  
-assertRoundTrip :: HUnit.Assertion
125  
-assertRoundTrip =
126  
-    do parsed <- case parseConfig mempty $ showConfig configWithSpaces of
127  
-                   ParseFailed err -> fail $ "Parse failed: " ++ show err
128  
-                   ParseOk _ val   -> return val
129  
-
130  
-       let check msg f =
131  
-               (HUnit.assertEqual msg `on` f) parsed configWithSpaces
132  
-
133  
-       check "globalLocalRepos" (globalLocalRepos . savedGlobalFlags)
134  
-       check "cache" (globalCacheDir . savedGlobalFlags)
135  
-       check "prefix" (show . prefix . savedUserInstallDirs)
136  
-       check "bindir" (show . bindir . savedUserInstallDirs)
137  
-       check "packageDB" (configPackageDB . savedConfigureFlags)
138  
-    where
139  
-      configWithSpaces =
140  
-          mempty { savedGlobalFlags =
141  
-                   mempty { globalLocalRepos = [pfx "repos"]
142  
-                          , globalCacheDir = toFlag $ pfx "cache"
143  
-                          }
144  
-                 , savedUserInstallDirs =
145  
-                   mempty { prefix = toFlag $ toPathTemplate $ pfx ""
146  
-                          , bindir = toFlag $ toPathTemplate $ pfx "binaries"
147  
-                          }
148  
-                 , savedConfigureFlags =
149  
-                   mempty { configPackageDB =
150  
-                            toFlag $ SpecificPackageDB $ pfx "package.db"
151  
-                          }
152  
-                 }
153  
-
154  
-      pfx = ("/path with spaces" </>)
155  
-
156  
-
157 97
 assertProgramOutput :: (String -> Bool) -> FilePath -> [String]
158 98
                     -> HUnit.Assertion
159 99
 assertProgramOutput f = assertProgram "has proper output" $

0 notes on commit e17a119

Please sign in to comment.
Something went wrong with that request. Please try again.