[commit: packages/Cabal] ghc-head: Use 'sdist --list-sources' for the timestamp check. (c7aa581)
git at git.haskell.org
git at git.haskell.org
Mon Aug 26 23:24:01 CEST 2013
Repository : ssh://git@git.haskell.org/Cabal
On branch : ghc-head
Link : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=c7aa58148fe881932be8dbf4092ce0672377afd3
>---------------------------------------------------------------
commit c7aa58148fe881932be8dbf4092ce0672377afd3
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date: Thu May 2 00:06:06 2013 +0200
Use 'sdist --list-sources' for the timestamp check.
>---------------------------------------------------------------
c7aa58148fe881932be8dbf4092ce0672377afd3
.../Distribution/Client/Sandbox/Timestamp.hs | 47 ++++++++++++++------
1 file changed, 34 insertions(+), 13 deletions(-)
diff --git a/cabal-install/Distribution/Client/Sandbox/Timestamp.hs b/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
index 3536a44..3b4e77d 100644
--- a/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
+++ b/cabal-install/Distribution/Client/Sandbox/Timestamp.hs
@@ -17,26 +17,36 @@ module Distribution.Client.Sandbox.Timestamp (
withModifiedDeps,
) where
+import Control.Exception (finally)
import Control.Monad (filterM, forM, when)
import Data.Char (isSpace)
import Data.List (partition)
-import System.Directory (renameFile)
+import System.Directory (removeFile, renameFile)
import System.FilePath ((<.>), (</>))
import Distribution.Compiler (CompilerId)
import Distribution.PackageDescription.Configuration (flattenPackageDescription)
import Distribution.PackageDescription.Parse (readPackageDescription)
-import Distribution.Simple.PreProcess (knownSuffixHandlers)
-import Distribution.Simple.SrcDist (listPackageSources)
-import Distribution.Simple.Utils (die, debug,
+import Distribution.Simple.Setup (Flag (..),
+ SDistFlags (..),
+ defaultSDistFlags,
+ sdistCommand)
+import Distribution.Simple.Utils (debug, die,
findPackageDesc, warn)
import Distribution.System (Platform)
import Distribution.Text (display)
-import Distribution.Verbosity (Verbosity)
+import Distribution.Verbosity (Verbosity, lessVerbose,
+ normal)
+import Distribution.Version (Version (..),
+ orLaterVersion)
-import Distribution.Client.Utils (inDir, tryCanonicalizePath)
import Distribution.Client.Sandbox.Index
- (ListIgnoredBuildTreeRefs(..), listBuildTreeRefs)
+ (ListIgnoredBuildTreeRefs (..), listBuildTreeRefs)
+import Distribution.Client.SetupWrapper (SetupScriptOptions (..),
+ defaultSetupScriptOptions,
+ setupWrapper)
+import Distribution.Client.Utils (inDir,
+ tryCanonicalizePath)
import Distribution.Compat.Exception (catchIO)
import Distribution.Compat.Time (EpochTime, getCurTime,
@@ -202,14 +212,25 @@ withActionOnCompilerTimestamps f sandboxDir compId platform act = do
-- FIXME: This function is not thread-safe because of 'inDir'.
allPackageSourceFiles :: Verbosity -> FilePath -> IO [FilePath]
allPackageSourceFiles verbosity packageDir = inDir (Just packageDir) $ do
- pkgDesc <- fmap (flattenPackageDescription)
- . readPackageDescription verbosity =<< findPackageDesc packageDir
- (ordinary, executable) <- listPackageSources verbosity pkgDesc pps
- mapM tryCanonicalizePath (executable ++ ordinary)
+ pkg <- fmap (flattenPackageDescription)
+ . readPackageDescription verbosity =<< findPackageDesc packageDir
- where
- pps = knownSuffixHandlers
+ let file = "cabal-sdist-list-sources"
+ flags = defaultSDistFlags {
+ sDistVerbosity = Flag $ if verbosity == normal
+ then lessVerbose verbosity else verbosity,
+ sDistListSources = Flag file
+ }
+ setupOpts = defaultSetupScriptOptions {
+ -- 'sdist --list-sources' was introduced in Cabal 1.17.
+ useCabalVersion = orLaterVersion $ Version [1,17,0] []
+ }
+ -- Run setup sdist --list-sources=TMPFILE
+ (flip finally) (removeFile file) $ do
+ setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags) []
+ srcs <- fmap lines . readFile $ file
+ mapM tryCanonicalizePath srcs
-- | Has this dependency been modified since we have last looked at it?
isDepModified :: Verbosity -> EpochTime -> AddSourceTimestamp -> IO Bool
More information about the ghc-commits
mailing list