Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #2 from nCdy/master

Upstream changes for cabal with gentoo-haskell patches
  • Loading branch information...
commit 5c3f0b59532d49fdd3840168e4354235ebb90aca 2 parents 79cfab9 + b3f9451
Mark Wright authored September 12, 2012

Showing 22 changed files with 194 additions and 101 deletions. Show diff stats Hide diff stats

  1. 7  .gitignore
  2. 2  Cabal/Cabal.cabal
  3. 4  Cabal/Distribution/Simple/Program/GHC.hs
  4. 13  Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Check.hs
  5. 13  Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Check.hs
  6. 18  Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs
  7. 8  Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
  8. 14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs
  9. 14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs
  10. 14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs
  11. 8  Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs
  12. 18  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
  13. 8  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs
  14. 16  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
  15. 38  Cabal/tests/PackageTests/PackageTester.hs
  16. 9  cabal-install/Distribution/Client/IndexUtils.hs
  17. 19  cabal-install/Distribution/Client/Install.hs
  18. 2  cabal-install/Distribution/Client/JobControl.hs
  19. 10  cabal-install/Distribution/Client/Tar.hs
  20. 37  cabal-install/Distribution/Compat/Time.hs
  21. 16  cabal-install/bootstrap.sh
  22. 7  cabal-install/cabal-install.cabal
7  .gitignore
@@ -10,6 +10,13 @@ cabal-install/dist/
10 10
 *.prof
11 11
 *.tix
12 12
 
  13
+# editor temp files
  14
+
  15
+*#
  16
+.#*
  17
+*~
  18
+.*.swp
  19
+
13 20
 # GHC build
14 21
 
15 22
 Cabal/GNUmakefile
2  Cabal/Cabal.cabal
@@ -8,7 +8,7 @@ Author: Isaac Jones <ijones@syntaxpolice.org>
8 8
         Duncan Coutts <duncan@community.haskell.org>
9 9
 Maintainer: cabal-devel@haskell.org
10 10
 Homepage: http://www.haskell.org/cabal/
11  
-bug-reports: http://hackage.haskell.org/trac/hackage/
  11
+bug-reports: https://github.com/haskell/cabal/issues
12 12
 Synopsis: A framework for packaging Haskell software
13 13
 Description:
14 14
         The Haskell Common Architecture for Building Applications and
4  Cabal/Distribution/Simple/Program/GHC.hs
@@ -300,7 +300,9 @@ renderGhcOptions version@(Version ver _) opts =
300 300
   ----------------------------
301 301
   -- Language and extensions
302 302
 
303  
-  , [ "-X" ++ display lang | lang <- flag ghcOptLanguage ]
  303
+  , if ver >= [7]
  304
+    then [ "-X" ++ display lang | lang <- flag ghcOptLanguage ]
  305
+    else []
304 306
 
305 307
   , [ case lookup ext (ghcOptExtensionMap opts) of
306 308
         Just arg -> arg
13  Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/Check.hs
@@ -4,12 +4,19 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import Data.List
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
10 12
 suite = TestCase $ do
11 13
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "GlobalBuildDepsNotAdditive1") []
12 14
     result <- cabal_build spec
13  
-    assertEqual "cabal build should fail - see test-log.txt" False (successful result)
14  
-    assertBool "cabal error should be \"Failed to load interface for `Prelude'\"" $
15  
-        "Failed to load interface for `Prelude'" `isInfixOf` outputText result
  15
+    do
  16
+        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
  17
+        let sb = "Could not find module `Prelude'"
  18
+        assertBool ("cabal output should be "++show sb) $
  19
+            sb `isInfixOf` outputText result
  20
+      `catch` \exc -> do
  21
+        putStrLn $ "Cabal result was "++show result
  22
+        throwIO (exc :: SomeException)
13  Cabal/tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/Check.hs
@@ -4,12 +4,19 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import Data.List
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
10 12
 suite = TestCase $ do
11 13
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "GlobalBuildDepsNotAdditive2") []
12 14
     result <- cabal_build spec
13  
-    assertEqual "cabal build should fail - see test-log.txt" False (successful result)
14  
-    assertBool "cabal error should be \"Failed to load interface for `Prelude'\"" $
15  
-        "Failed to load interface for `Prelude'" `isInfixOf` outputText result
  15
+    do
  16
+        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
  17
+        let sb = "Could not find module `Prelude'"
  18
+        assertBool ("cabal output should be "++show sb) $
  19
+            sb `isInfixOf` outputText result
  20
+      `catch` \exc -> do
  21
+        putStrLn $ "Cabal result was "++show result
  22
+        throwIO (exc :: SomeException)
18  Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs
@@ -6,15 +6,21 @@ import Control.Monad
6 6
 import System.FilePath
7 7
 import Data.Version
8 8
 import Data.List (isInfixOf, intercalate)
  9
+import Control.Exception
  10
+import Prelude hiding (catch)
9 11
 
10 12
 
11 13
 suite :: Version -> Test
12 14
 suite cabalVersion = TestCase $ do
13 15
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary0") []
14 16
     result <- cabal_build spec
15  
-    assertEqual "cabal build should fail" False (successful result)
16  
-    when (cabalVersion >= Version [1, 7] []) $ do
17  
-        -- In 1.7 it should tell you how to enable the desired behaviour.
18  
-        assertEqual "error should say 'library which is defined within the same package.'" True $
19  
-            "library which is defined within the same package." `isInfixOf` (intercalate " " $ lines $ outputText result)
20  
-
  17
+    do
  18
+        assertEqual "cabal build should fail" False (successful result)
  19
+        when (cabalVersion >= Version [1, 7] []) $ do
  20
+            let sb = "library which is defined within the same package."
  21
+            -- In 1.7 it should tell you how to enable the desired behaviour.
  22
+            assertEqual ("cabal output should say "++show sb) True $
  23
+                sb `isInfixOf` (intercalate " " $ lines $ outputText result)
  24
+      `catch` \exc -> do
  25
+        putStrLn $ "Cabal result was "++show result
  26
+        throwIO (exc :: SomeException)
8  Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
@@ -3,10 +3,16 @@ module PackageTests.BuildDeps.InternalLibrary1.Check where
3 3
 import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
  6
+import Control.Exception
  7
+import Prelude hiding (catch)
6 8
 
7 9
 
8 10
 suite :: Test
9 11
 suite = TestCase $ do
10 12
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary1") []
11 13
     result <- cabal_build spec
12  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  14
+    do
  15
+        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  16
+      `catch` \exc -> do
  17
+        putStrLn $ "Cabal result was "++show result
  18
+        throwIO (exc :: SomeException)
14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs
@@ -4,6 +4,8 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import qualified Data.ByteString.Char8 as C
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
@@ -13,9 +15,17 @@ suite = TestCase $ do
13 15
 
14 16
     unregister "InternalLibrary2"
15 17
     iResult <- cabal_install specTI                     
16  
-    assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
  18
+    do
  19
+        assertEqual "cabal install should succeed" True (successful iResult)
  20
+      `catch` \exc -> do
  21
+        putStrLn $ "Cabal result was "++show iResult
  22
+        throwIO (exc :: SomeException)
17 23
     bResult <- cabal_build spec
18  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
  24
+    do
  25
+        assertEqual "cabal build should succeed" True (successful bResult)
  26
+      `catch` \exc -> do
  27
+        putStrLn $ "Cabal result was "++show bResult
  28
+        throwIO (exc :: SomeException)
19 29
     unregister "InternalLibrary2"
20 30
 
21 31
     (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs
@@ -4,6 +4,8 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import qualified Data.ByteString.Char8 as C
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
@@ -13,9 +15,17 @@ suite = TestCase $ do
13 15
 
14 16
     unregister "InternalLibrary3"
15 17
     iResult <- cabal_install specTI                     
16  
-    assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
  18
+    do
  19
+        assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
  20
+      `catch` \exc -> do
  21
+        putStrLn $ "Cabal result was "++show iResult
  22
+        throwIO (exc :: SomeException)
17 23
     bResult <- cabal_build spec
18  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
  24
+    do
  25
+        assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
  26
+      `catch` \exc -> do
  27
+        putStrLn $ "Cabal result was "++show bResult
  28
+        throwIO (exc :: SomeException)
19 29
     unregister "InternalLibrary3"
20 30
 
21 31
     (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
14  Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs
@@ -4,6 +4,8 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import qualified Data.ByteString.Char8 as C
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
@@ -13,9 +15,17 @@ suite = TestCase $ do
13 15
 
14 16
     unregister "InternalLibrary4"
15 17
     iResult <- cabal_install specTI                     
16  
-    assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
  18
+    do
  19
+        assertEqual "cabal install should succeed - see to-install/test-log.txt" True (successful iResult)
  20
+      `catch` \exc -> do
  21
+        putStrLn $ "Cabal result was "++show iResult
  22
+        throwIO (exc :: SomeException)
17 23
     bResult <- cabal_build spec
18  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
  24
+    do
  25
+        assertEqual "cabal build should succeed - see test-log.txt" True (successful bResult)
  26
+      `catch` \exc -> do
  27
+        putStrLn $ "Cabal result was "++show bResult
  28
+        throwIO (exc :: SomeException)
19 29
     unregister "InternalLibrary4"
20 30
 
21 31
     (_, _, output) <- run (Just $ directory spec) "dist/build/lemon/lemon" []
8  Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs
@@ -3,10 +3,16 @@ module PackageTests.BuildDeps.SameDepsAllRound.Check where
3 3
 import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
  6
+import Control.Exception
  7
+import Prelude hiding (catch)
6 8
 
7 9
 
8 10
 suite :: Test
9 11
 suite = TestCase $ do
10 12
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "SameDepsAllRound") []
11 13
     result <- cabal_build spec
12  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  14
+    do
  15
+        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  16
+      `catch` \exc -> do
  17
+        putStrLn $ "Cabal result was "++show result
  18
+        throwIO (exc :: SomeException)
18  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
@@ -4,15 +4,21 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import Data.List
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
10 12
 suite = TestCase $ do
11 13
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps1") []
12 14
     result <- cabal_build spec
13  
-    assertEqual "cabal build should fail - see test-log.txt" False (successful result)
14  
-    assertBool "error should be in MyLibrary.hs" $
15  
-        "MyLibrary.hs:" `isInfixOf` outputText result
16  
-    assertBool "error should be \"Could not find module `System.Time\"" $
17  
-        "Could not find module `System.Time'" `isInfixOf`
18  
-                        (intercalate " " $ lines $ outputText result)
  15
+    do
  16
+        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
  17
+        assertBool "error should be in MyLibrary.hs" $
  18
+            "MyLibrary.hs:" `isInfixOf` outputText result
  19
+        assertBool "error should be \"Could not find module `System.Time\"" $
  20
+            "Could not find module `System.Time'" `isInfixOf`
  21
+                            (intercalate " " $ lines $ outputText result)
  22
+      `catch` \exc -> do
  23
+        putStrLn $ "Cabal result was "++show result
  24
+        throwIO (exc :: SomeException)
8  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs
@@ -4,10 +4,16 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import Data.List
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
10 12
 suite = TestCase $ do
11 13
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps2") []
12 14
     result <- cabal_build spec
13  
-    assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  15
+    do
  16
+        assertEqual "cabal build should succeed - see test-log.txt" True (successful result)
  17
+      `catch` \exc -> do
  18
+        putStrLn $ "Cabal result was "++show result
  19
+        throwIO (exc :: SomeException)
16  Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
@@ -4,14 +4,20 @@ import Test.HUnit
4 4
 import PackageTests.PackageTester
5 5
 import System.FilePath
6 6
 import Data.List
  7
+import Control.Exception
  8
+import Prelude hiding (catch)
7 9
 
8 10
 
9 11
 suite :: Test
10 12
 suite = TestCase $ do
11 13
     let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps3") []
12 14
     result <- cabal_build spec
13  
-    assertEqual "cabal build should fail - see test-log.txt" False (successful result)
14  
-    assertBool "error should be in lemon.hs" $
15  
-        "lemon.hs:" `isInfixOf` outputText result
16  
-    assertBool "error should be \"Could not find module `System.Time\"" $
17  
-        "Could not find module `System.Time'" `isInfixOf` (intercalate " " $ lines $ outputText result)
  15
+    do
  16
+        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
  17
+        assertBool "error should be in lemon.hs" $
  18
+            "lemon.hs:" `isInfixOf` outputText result
  19
+        assertBool "error should be \"Could not find module `System.Time\"" $
  20
+            "Could not find module `System.Time'" `isInfixOf` (intercalate " " $ lines $ outputText result)
  21
+      `catch` \exc -> do
  22
+        putStrLn $ "Cabal result was "++show result
  23
+        throwIO (exc :: SomeException)
38  Cabal/tests/PackageTests/PackageTester.hs
@@ -144,32 +144,13 @@ run :: Maybe FilePath -> String -> [String] -> IO (String, ExitCode, String)
144 144
 run cwd cmd args = do
145 145
     -- Posix-specific
146 146
     (outf, outf0) <- createPipe
147  
-    (errf, errf0) <- createPipe
148 147
     outh <- fdToHandle outf
149 148
     outh0 <- fdToHandle outf0
150  
-    errh <- fdToHandle errf
151  
-    errh0 <- fdToHandle errf0
152  
-    pid <- runProcess cmd args cwd Nothing Nothing (Just outh0) (Just errh0)
153  
-
154  
-    {-
155  
-    -- ghc-6.10.1 specific
156  
-    (Just inh, Just outh, Just errh, pid) <-
157  
-        createProcess (proc cmd args){ std_in  = CreatePipe,
158  
-                                       std_out = CreatePipe,
159  
-                                       std_err = CreatePipe,
160  
-                                       cwd     = cwd }
161  
-    hClose inh -- done with stdin
162  
-    -}
  149
+    pid <- runProcess cmd args cwd Nothing Nothing (Just outh0) (Just outh0)
163 150
 
164 151
     -- fork off a thread to start consuming the output
165  
-    outChan <- newChan
166  
-    forkIO $ suckH outChan outh
167  
-    forkIO $ suckH outChan errh
168  
-
169  
-    output <- suckChan outChan
170  
-
  152
+    output <- suckH [] outh
171 153
     hClose outh
172  
-    hClose errh
173 154
 
174 155
     -- wait on the process
175 156
     ex <- waitForProcess pid
@@ -177,22 +158,13 @@ run cwd cmd args = do
177 158
     return ("\"" ++ fullCmd ++ "\" in " ++ fromMaybe "" cwd,
178 159
         ex, output)
179 160
   where
180  
-    suckH chan h = do
  161
+    suckH output h = do
181 162
         eof <- hIsEOF h
182 163
         if eof
183  
-            then writeChan chan Nothing
  164
+            then return (reverse output)
184 165
             else do
185 166
                 c <- hGetChar h
186  
-                writeChan chan $ Just c
187  
-                suckH chan h
188  
-    suckChan chan = sc' chan 2 []
189  
-      where
190  
-        sc' _ 0 acc = return $ reverse acc
191  
-        sc' chan eofs acc = do
192  
-            mC <- readChan chan
193  
-            case mC of
194  
-                Just c -> sc' chan eofs (c:acc)
195  
-                Nothing -> sc' chan (eofs-1) acc
  167
+                suckH (c:output) h
196 168
 
197 169
 requireSuccess :: (String, ExitCode, String) -> IO ()
198 170
 requireSuccess (cmd, exitCode, output) = do
9  cabal-install/Distribution/Client/IndexUtils.hs
@@ -76,8 +76,7 @@ import System.IO.Error (isDoesNotExistError)
76 76
 import Distribution.Compat.Exception (catchIO)
77 77
 import System.Directory
78 78
          ( getModificationTime, doesFileExist )
79  
-import System.Time
80  
-         ( getClockTime, diffClockTimes, normalizeTimeDiff, TimeDiff(tdDay) )
  79
+import Distribution.Compat.Time
81 80
 
82 81
 
83 82
 getInstalledPackages :: Verbosity -> Compiler
@@ -196,10 +195,8 @@ readRepoIndex verbosity repo =
196 195
 
197 196
     isOldThreshold = 15 --days
198 197
     warnIfIndexIsOld indexFile = do
199  
-      indexTime   <- getModificationTime indexFile
200  
-      currentTime <- getClockTime
201  
-      let diff = normalizeTimeDiff (diffClockTimes currentTime indexTime)
202  
-      when (tdDay diff >= isOldThreshold) $ case repoKind repo of
  198
+      dt <- getFileAge indexFile
  199
+      when (dt >= isOldThreshold) $ case repoKind repo of
203 200
         Left  remoteRepo -> warn verbosity $
204 201
              "The package list for '" ++ remoteRepoName remoteRepo
205 202
           ++ "' is " ++ show (tdDay diff)  ++ " days old.\nRun "
19  cabal-install/Distribution/Client/Install.hs
@@ -506,15 +506,20 @@ printPlan dryRun verbosity plan sourcePkgDb = case plan of
506 506
                 diff -> " changes: "  ++ intercalate ", " (map change diff)
507 507
 
508 508
     showLatest :: ConfiguredPackage -> String
509  
-    showLatest pkg = if pkgVersion /= latestVersion
510  
-                     then (" (latest: " ++ display latestVersion ++ ")")
511  
-                     else ""
  509
+    showLatest pkg = case mLatestVersion of
  510
+        Just latestVersion ->
  511
+            if pkgVersion /= latestVersion
  512
+            then (" (latest: " ++ display latestVersion ++ ")")
  513
+            else ""
  514
+        Nothing -> ""
512 515
       where
513 516
         pkgVersion    = packageVersion pkg
514  
-        latestVersion =
515  
-          packageVersion . last
516  
-          . SourcePackageIndex.lookupPackageName (packageIndex sourcePkgDb)
517  
-          $ (packageName pkg)
  517
+        mLatestVersion :: Maybe Version
  518
+        mLatestVersion = case SourcePackageIndex.lookupPackageName
  519
+                                (packageIndex sourcePkgDb)
  520
+                                (packageName pkg) of
  521
+            [] -> Nothing
  522
+            x -> Just $ packageVersion $ last x
518 523
 
519 524
     toFlagAssignment :: [Flag] -> FlagAssignment
520 525
     toFlagAssignment = map (\ f -> (flagName f, flagDefault f))
2  cabal-install/Distribution/Client/JobControl.hs
@@ -29,8 +29,6 @@ module Distribution.Client.JobControl (
29 29
 import Control.Monad
30 30
 import Control.Concurrent
31 31
 import Control.Exception
32  
-import Prelude hiding (catch)
33  
-
34 32
 
35 33
 data JobControl m a = JobControl {
36 34
        spawnJob    :: m a -> m (),
10  cabal-install/Distribution/Client/Tar.hs
@@ -91,8 +91,7 @@ import Distribution.Compat.FilePerms
91 91
          ( setFileExecutable )
92 92
 import System.Posix.Types
93 93
          ( FileMode )
94  
-import System.Time
95  
-         ( ClockTime(..) )
  94
+import Distribution.Compat.Time
96 95
 import System.IO
97 96
          ( IOMode(ReadMode), openBinaryFile, hFileSize )
98 97
 import System.IO.Unsafe (unsafeInterleaveIO)
@@ -123,8 +122,6 @@ extractTarGzFile dir expected tar = do
123 122
 --
124 123
 
125 124
 type FileSize  = Int64
126  
--- | The number of seconds since the UNIX epoch
127  
-type EpochTime = Int64
128 125
 type DevMajor  = Int
129 126
 type DevMinor  = Int
130 127
 type TypeCode  = Char
@@ -927,8 +924,3 @@ recurseDirectories base (dir:dirs) = unsafeInterleaveIO $ do
927 924
     ignore ['.']      = True
928 925
     ignore ['.', '.'] = True
929 926
     ignore _          = False
930  
-
931  
-getModTime :: FilePath -> IO EpochTime
932  
-getModTime path = do
933  
-  (TOD s _) <- getModificationTime path
934  
-  return $! fromIntegral s
37  cabal-install/Distribution/Compat/Time.hs
... ...
@@ -0,0 +1,37 @@
  1
+{-# LANGUAGE CPP #-}
  2
+module Distribution.Compat.Time where
  3
+
  4
+import Data.Int (Int64)
  5
+import System.Directory (getModificationTime)
  6
+
  7
+#if MIN_VERSION_directory(1,2,0)
  8
+import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds, posixDayLength)
  9
+import Data.Time (getCurrentTime, diffUTCTime)
  10
+#else
  11
+import System.Time (ClockTime(..), getClockTime, diffClockTimes, normalizeTimeDiff, tdDay)
  12
+#endif
  13
+
  14
+-- | The number of seconds since the UNIX epoch
  15
+type EpochTime = Int64
  16
+
  17
+getModTime :: FilePath -> IO EpochTime
  18
+getModTime path =  do
  19
+#if MIN_VERSION_directory(1,2,0)
  20
+  (truncate . utcTimeToPOSIXSeconds) `fmap` getModificationTime path
  21
+#else
  22
+  (TOD s _) <- getModificationTime path
  23
+  return $! fromIntegral s
  24
+#endif
  25
+
  26
+-- | Return age of given file in days.
  27
+getFileAge :: FilePath -> IO Int
  28
+getFileAge file = do
  29
+  t0 <- getModificationTime file
  30
+#if MIN_VERSION_directory(1,2,0)
  31
+  t1 <- getCurrentTime
  32
+  let days = truncate $ (t1 `diffUTCTime` t0) / posixDayLength
  33
+#else
  34
+  t1 <- getClockTime
  35
+  let days = (tdDay . normalizeTimeDiff) (t1 `diffClockTimes` t0)
  36
+#endif
  37
+  return days
16  cabal-install/bootstrap.sh
@@ -47,16 +47,16 @@ PREFIX=${PREFIX:-${DEFAULT_PREFIX}}
47 47
 
48 48
 # Versions of the packages to install.
49 49
 # The version regex says what existing installed versions are ok.
50  
-PARSEC_VER="3.1.2";    PARSEC_VER_REGEXP="[23]\."  # == 2.* || == 3.*
51  
-DEEPSEQ_VER="1.3.0.0"; DEEPSEQ_VER_REGEXP="1\.[1-9]\." # >= 1.1 && < 2
52  
-TEXT_VER="0.11.2.0";  TEXT_VER_REGEXP="0\.([2-9]|(1[0-1]))\." # >= 0.2 && < 0.12
53  
-NETWORK_VER="2.3.0.13"; NETWORK_VER_REGEXP="2\."    # == 2.*
54  
-CABAL_VER="1.14.0";    CABAL_VER_REGEXP="1\.(13\.3|14\.)"  # >= 1.13.3 && < 1.15
  50
+PARSEC_VER="3.1.3";    PARSEC_VER_REGEXP="[23]\."  # == 2.* || == 3.*
  51
+DEEPSEQ_VER="1.3.0.1"; DEEPSEQ_VER_REGEXP="1\.[1-9]\." # >= 1.1 && < 2
  52
+TEXT_VER="0.11.2.3";  TEXT_VER_REGEXP="0\.([2-9]|(1[0-1]))\." # >= 0.2 && < 0.12
  53
+NETWORK_VER="2.3.1.0"; NETWORK_VER_REGEXP="2\."    # == 2.*
  54
+CABAL_VER="1.16.0";    CABAL_VER_REGEXP="1\.(13\.3|1[4-7]\.)"  # >= 1.13.3 && < 1.18
55 55
 TRANS_VER="0.3.0.0";   TRANS_VER_REGEXP="0\.[23]\."   # >= 0.2.* && < 0.4.*
56  
-MTL_VER="2.1.1";     MTL_VER_REGEXP="[12]\."     # == 1.* || == 2.*
57  
-HTTP_VER="4000.2.3";   HTTP_VER_REGEXP="4000\.[012]\." # == 4000.0.* || 4000.1.* || 4000.2.*
  56
+MTL_VER="2.1.2";     MTL_VER_REGEXP="[12]\."     # == 1.* || == 2.*
  57
+HTTP_VER="4000.2.4";   HTTP_VER_REGEXP="4000\.[012]\." # == 4000.0.* || 4000.1.* || 4000.2.*
58 58
 ZLIB_VER="0.5.3.3";    ZLIB_VER_REGEXP="0\.[45]\." # == 0.4.* || == 0.5.*
59  
-TIME_VER="1.4"         TIME_VER_REGEXP="1\.[1234]\.?" # >= 1.1 && < 1.5
  59
+TIME_VER="1.4.0.1"     TIME_VER_REGEXP="1\.[1234]\.?" # >= 1.1 && < 1.5
60 60
 RANDOM_VER="1.0.1.1"   RANDOM_VER_REGEXP="1\.0\." # >= 1 && < 1.1
61 61
 
62 62
 HACKAGE_URL="http://hackage.haskell.org/packages/archive"
7  cabal-install/cabal-install.cabal
@@ -6,7 +6,7 @@ Description:
6 6
     Haskell software by automating the fetching, configuration, compilation
7 7
     and installation of Haskell libraries and programs.
8 8
 homepage:           http://www.haskell.org/cabal/
9  
-bug-reports:        http://hackage.haskell.org/trac/hackage/
  9
+bug-reports:        https://github.com/haskell/cabal/issues
10 10
 License:            BSD3
11 11
 License-File:       LICENSE
12 12
 Author:             Lemmih <lemmih@gmail.com>
@@ -87,11 +87,13 @@ Executable cabal
87 87
         Distribution.Client.Install
88 88
         Distribution.Client.InstallPlan
89 89
         Distribution.Client.InstallSymlink
  90
+        Distribution.Client.JobControl
90 91
         Distribution.Client.List
91 92
         Distribution.Client.PackageEnvironment
92 93
         Distribution.Client.PackageIndex
93 94
         Distribution.Client.PackageUtils
94 95
         Distribution.Client.ParseUtils
  96
+        Distribution.Client.Sandbox
95 97
         Distribution.Client.Setup
96 98
         Distribution.Client.SetupWrapper
97 99
         Distribution.Client.SrcDist
@@ -106,6 +108,7 @@ Executable cabal
106 108
         Distribution.Client.Win32SelfUpgrade
107 109
         Distribution.Compat.Exception
108 110
         Distribution.Compat.FilePerms
  111
+        Distribution.Compat.Time
109 112
         Paths_cabal_install
110 113
 
111 114
     build-depends: base     >= 2        && < 5,
@@ -138,6 +141,6 @@ Executable cabal
138 141
       build-depends: Win32 >= 2 && < 3
139 142
       cpp-options: -DWIN32
140 143
     else
141  
-      build-depends: unix >= 1.0 && < 2.6
  144
+      build-depends: unix >= 1.0 && < 2.7
142 145
     extensions: CPP, ForeignFunctionInterface
143 146
     c-sources: cbits/getnumcores.c

0 notes on commit 5c3f0b5

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