Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix sdist so that it preserves executable permissions

Needed for ./configure scripts etc.
  • Loading branch information...
commit dd4d4af848f8ce5890e5eda484dbe049fc3248e1 1 parent d64bb03
@dcoutts dcoutts authored
Showing with 15 additions and 5 deletions.
  1. +11 −3 Distribution/Simple/SrcDist.hs
  2. +4 −2 Distribution/Simple/Utils.hs
View
14 Distribution/Simple/SrcDist.hs
@@ -78,10 +78,10 @@ import Distribution.Version
( Version(versionBranch), VersionRange(AnyVersion) )
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, withUTF8FileContents, writeUTF8File
- , copyFiles, copyFileVerbose
+ , copyFiles
, findFile, findFileWithExtension, matchFileGlob
, withTempDirectory, defaultPackageDesc
- , die, warn, notice, setupMessage )
+ , die, warn, notice, setupMessage, info )
import Distribution.Simple.Setup (SDistFlags(..), fromFlag)
import Distribution.Simple.PreProcess (PPSuffixHandler, ppSuffixes, preprocessSources)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) )
@@ -96,7 +96,7 @@ import Data.Char (toLower)
import Data.List (partition, isPrefixOf)
import Data.Maybe (isNothing, catMaybes)
import System.Time (getClockTime, toCalendarTime, CalendarTime(..))
-import System.Directory (doesFileExist, doesDirectoryExist)
+import System.Directory (doesFileExist, doesDirectoryExist, copyFile)
import Distribution.Verbosity (Verbosity)
import System.FilePath
( (</>), (<.>), takeDirectory, dropExtension, isAbsolute )
@@ -342,6 +342,14 @@ copyFileTo verbosity dir file = do
createDirectoryIfMissingVerbose verbosity True (takeDirectory targetFile)
copyFileVerbose verbosity file targetFile
+copyFileVerbose :: Verbosity -> FilePath -> FilePath -> IO ()
+copyFileVerbose verbosity src dest = do
+ info verbosity ("copy " ++ src ++ " to " ++ dest)
+ --Note: This is the standard copyFile that *does* copy file permissions.
+ -- In particular it will copy executable permissions which we need
+ -- eg to copy ./configure scripts into the tarball src tree.
+ copyFile src dest
+
printPackageProblems :: Verbosity -> PackageDescription -> IO ()
printPackageProblems verbosity pkg_descr = do
ioChecks <- checkPackageFiles pkg_descr "."
View
6 Distribution/Simple/Utils.hs
@@ -127,7 +127,8 @@ import Data.Bits
( Bits((.|.), (.&.), shiftL, shiftR) )
import System.Directory
- ( getDirectoryContents, doesDirectoryExist, doesFileExist, removeFile )
+ ( getDirectoryContents, doesDirectoryExist, doesFileExist, removeFile
+ , copyFile )
import System.Environment
( getProgName )
import System.Cmd
@@ -531,7 +532,8 @@ copyFiles verbosity targetDir srcFiles = do
-- Copy all the files
sequence_ [ let src = srcBase </> srcFile
dest = targetDir </> srcFile
- in copyFileVerbose verbosity src dest
+ in info verbosity ("copy " ++ src ++ " to " ++ dest)
+ >> copyFile src dest
| (srcBase, srcFile) <- srcFiles ]
-- adaptation of removeDirectoryRecursive
Please sign in to comment.
Something went wrong with that request. Please try again.