bring back OsPath changes
I hope that the windows test suite failure on appveyor was fixed by updating to a newer windows there. I have not been able to reproduce that failure in a windows 11 VM run locally.
This commit is contained in:
parent
f0ab439c95
commit
84291b6014
119 changed files with 1003 additions and 647 deletions
|
@ -26,11 +26,12 @@ import Utility.Path.AbsRel
|
|||
import Utility.FileMode
|
||||
import Utility.CopyFile
|
||||
import Utility.FileSystemEncoding
|
||||
import Utility.SystemDirectory
|
||||
|
||||
mklibs :: FilePath -> a -> IO Bool
|
||||
mklibs top _installedbins = do
|
||||
fs <- dirContentsRecursive top
|
||||
exes <- filterM checkExe fs
|
||||
fs <- dirContentsRecursive (toRawFilePath top)
|
||||
exes <- filterM checkExe (map fromRawFilePath fs)
|
||||
libs <- runLdd exes
|
||||
|
||||
glibclibs <- glibcLibs
|
||||
|
@ -80,7 +81,7 @@ consolidateUsrLib top libdirs = go [] libdirs
|
|||
forM_ fs $ \f -> do
|
||||
let src = inTop top (x </> f)
|
||||
let dst = inTop top (d </> f)
|
||||
unless (dirCruft f) $
|
||||
unless (dirCruft (toRawFilePath f)) $
|
||||
unlessM (doesDirectoryExist src) $
|
||||
renameFile src dst
|
||||
symlinkHwCapDirs top d
|
||||
|
|
|
@ -25,6 +25,7 @@ import Utility.Path.AbsRel
|
|||
import Utility.Directory
|
||||
import Utility.Env
|
||||
import Utility.FileSystemEncoding
|
||||
import Utility.SystemDirectory
|
||||
import Build.BundledPrograms
|
||||
#ifdef darwin_HOST_OS
|
||||
import System.IO
|
||||
|
@ -71,14 +72,15 @@ installGitLibs topdir = do
|
|||
-- install git-core programs; these are run by the git command
|
||||
createDirectoryIfMissing True gitcoredestdir
|
||||
execpath <- getgitpath "exec-path"
|
||||
cfs <- dirContents execpath
|
||||
cfs <- dirContents (toRawFilePath execpath)
|
||||
forM_ cfs $ \f -> do
|
||||
let f' = fromRawFilePath f
|
||||
destf <- ((gitcoredestdir </>) . fromRawFilePath)
|
||||
<$> relPathDirToFile
|
||||
(toRawFilePath execpath)
|
||||
(toRawFilePath f)
|
||||
f
|
||||
createDirectoryIfMissing True (takeDirectory destf)
|
||||
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f
|
||||
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f'
|
||||
if issymlink
|
||||
then do
|
||||
-- many git-core files may symlink to eg
|
||||
|
@ -91,20 +93,20 @@ installGitLibs topdir = do
|
|||
-- Other git-core files symlink to a file
|
||||
-- beside them in the directory. Those
|
||||
-- links can be copied as-is.
|
||||
linktarget <- readSymbolicLink f
|
||||
linktarget <- readSymbolicLink f'
|
||||
if takeFileName linktarget == linktarget
|
||||
then cp f destf
|
||||
then cp f' destf
|
||||
else do
|
||||
let linktarget' = progDir topdir </> takeFileName linktarget
|
||||
unlessM (doesFileExist linktarget') $ do
|
||||
createDirectoryIfMissing True (takeDirectory linktarget')
|
||||
L.readFile f >>= L.writeFile linktarget'
|
||||
L.readFile f' >>= L.writeFile linktarget'
|
||||
removeWhenExistsWith removeLink destf
|
||||
rellinktarget <- relPathDirToFile
|
||||
(toRawFilePath (takeDirectory destf))
|
||||
(toRawFilePath linktarget')
|
||||
createSymbolicLink (fromRawFilePath rellinktarget) destf
|
||||
else cp f destf
|
||||
else cp f' destf
|
||||
|
||||
-- install git's template files
|
||||
-- git does not have an option to get the path of these,
|
||||
|
@ -112,14 +114,14 @@ installGitLibs topdir = do
|
|||
-- next to the --man-path, in eg /usr/share/git-core
|
||||
manpath <- getgitpath "man-path"
|
||||
let templatepath = manpath </> ".." </> "git-core" </> "templates"
|
||||
tfs <- dirContents templatepath
|
||||
tfs <- dirContents (toRawFilePath templatepath)
|
||||
forM_ tfs $ \f -> do
|
||||
destf <- ((templatedestdir </>) . fromRawFilePath)
|
||||
<$> relPathDirToFile
|
||||
(toRawFilePath templatepath)
|
||||
(toRawFilePath f)
|
||||
f
|
||||
createDirectoryIfMissing True (takeDirectory destf)
|
||||
cp f destf
|
||||
cp (fromRawFilePath f) destf
|
||||
where
|
||||
gitcoredestdir = topdir </> "git-core"
|
||||
templatedestdir = topdir </> "templates"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{- Package version determination. -}
|
||||
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE LambdaCase, OverloadedStrings #-}
|
||||
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||
|
||||
module Build.Version where
|
||||
|
@ -14,7 +14,9 @@ import Prelude
|
|||
|
||||
import Utility.Monad
|
||||
import Utility.Exception
|
||||
import Utility.Misc
|
||||
import Utility.OsPath
|
||||
import Utility.FileSystemEncoding
|
||||
import qualified Utility.FileIO as F
|
||||
|
||||
type Version = String
|
||||
|
||||
|
@ -56,11 +58,11 @@ getChangelogVersion = do
|
|||
middle = drop 1 . init
|
||||
|
||||
writeVersion :: Version -> IO ()
|
||||
writeVersion ver = catchMaybeIO (readFileStrict f) >>= \case
|
||||
writeVersion ver = catchMaybeIO (F.readFile' f) >>= \case
|
||||
Just s | s == body -> return ()
|
||||
_ -> writeFile f body
|
||||
_ -> F.writeFile' f body
|
||||
where
|
||||
body = unlines $ concat
|
||||
body = encodeBS $ unlines $ concat
|
||||
[ header
|
||||
, ["packageversion :: String"]
|
||||
, ["packageversion = \"" ++ ver ++ "\""]
|
||||
|
@ -71,4 +73,4 @@ writeVersion ver = catchMaybeIO (readFileStrict f) >>= \case
|
|||
, ""
|
||||
]
|
||||
footer = []
|
||||
f = "Build/Version"
|
||||
f = toOsPath "Build/Version"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue