update after RawFilePath transition

This commit is contained in:
Joey Hess 2020-11-09 12:06:53 -04:00
parent 7df2979d98
commit dd52d8ebdc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 31 additions and 13 deletions

View file

@ -21,8 +21,10 @@ import Utility.Directory
import Utility.Process
import Utility.Monad
import Utility.Path
import Utility.Path.AbsRel
import Utility.FileMode
import Utility.CopyFile
import Utility.FileSystemEncoding
mklibs :: FilePath -> a -> IO Bool
mklibs top _installedbins = do
@ -42,7 +44,7 @@ mklibs top _installedbins = do
-- Various files used by runshell to set up env vars used by the
-- linker shims.
writeFile (top </> "libdirs") (unlines libdirs')
writeFile (top </> "gconvdir") (parentDir $ Prelude.head gconvlibs)
writeFile (top </> "gconvdir") (fromRawFilePath $ parentDir $ toRawFilePath $ Prelude.head gconvlibs)
mapM_ (installLib installFile top) linkers
let linker = Prelude.head linkers
@ -107,16 +109,18 @@ installLinkerShim top linker exe = do
createSymbolicLink sl' exedest
, renameFile exe exedest
)
link <- relPathDirToFile (top </> exedir) (top ++ linker)
link <- relPathDirToFile
(toRawFilePath (top </> exedir))
(toRawFilePath (top ++ linker))
unlessM (doesFileExist (top </> exelink)) $
createSymbolicLink link (top </> exelink)
createSymbolicLink (fromRawFilePath link) (top </> exelink)
writeFile exe $ unlines
[ "#!/bin/sh"
, "GIT_ANNEX_PROGRAMPATH=\"$0\""
, "export GIT_ANNEX_PROGRAMPATH"
, "exec \"$GIT_ANNEX_DIR/" ++ exelink ++ "\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_DIR/shimmed/" ++ base ++ "/" ++ base ++ "\" \"$@\""
]
modifyFileMode exe $ addModes executeModes
modifyFileMode (toRawFilePath exe) $ addModes executeModes
where
base = takeFileName exe
shimdir = "shimmed" </> base
@ -129,7 +133,7 @@ installFile top f = do
createDirectoryIfMissing True destdir
void $ copyFileExternal CopyTimeStamps f destdir
where
destdir = inTop top $ parentDir f
destdir = inTop top $ fromRawFilePath $ parentDir $ toRawFilePath f
checkExe :: FilePath -> IO Bool
checkExe f

View file

@ -24,6 +24,7 @@ import Utility.Path
import Utility.Exception
import Utility.Env
import Utility.Split
import Utility.FileSystemEncoding
import qualified Data.Map as M
import qualified Data.Set as S
@ -63,7 +64,7 @@ installLibs appbase installedbins replacement_libs libmap = do
ifM (doesFileExist dest)
( return Nothing
, do
createDirectoryIfMissing True (parentDir dest)
createDirectoryIfMissing True (fromRawFilePath (parentDir (toRawFilePath dest)))
putStrLn $ "installing " ++ pathlib ++ " as " ++ shortlib
unlessM (boolSystem "cp" [File pathlib, File dest]
<&&> boolSystem "chmod" [Param "644", File dest]

View file

@ -21,8 +21,10 @@ import qualified Data.Map as M
import Utility.SafeCommand
import Utility.Process
import Utility.Path
import Utility.Path.AbsRel
import Utility.Directory
import Utility.Env
import Utility.FileSystemEncoding
import Build.BundledPrograms
#ifdef darwin_HOST_OS
import System.IO
@ -71,8 +73,10 @@ installGitLibs topdir = do
execpath <- getgitpath "exec-path"
cfs <- dirContents execpath
forM_ cfs $ \f -> do
destf <- (gitcoredestdir </>)
<$> relPathDirToFile execpath f
destf <- ((gitcoredestdir </>) . fromRawFilePath)
<$> relPathDirToFile
(toRawFilePath execpath)
(toRawFilePath f)
createDirectoryIfMissing True (takeDirectory destf)
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f
if issymlink
@ -96,8 +100,10 @@ installGitLibs topdir = do
createDirectoryIfMissing True (takeDirectory linktarget')
L.readFile f >>= L.writeFile linktarget'
removeWhenExistsWith removeLink destf
rellinktarget <- relPathDirToFile (takeDirectory destf) linktarget'
createSymbolicLink rellinktarget destf
rellinktarget <- relPathDirToFile
(toRawFilePath (takeDirectory destf))
(toRawFilePath linktarget')
createSymbolicLink (fromRawFilePath rellinktarget) destf
else cp f destf
-- install git's template files
@ -108,8 +114,10 @@ installGitLibs topdir = do
let templatepath = manpath </> ".." </> "git-core" </> "templates"
tfs <- dirContents templatepath
forM_ tfs $ \f -> do
destf <- (templatedestdir </>)
<$> relPathDirToFile templatepath f
destf <- ((templatedestdir </>) . fromRawFilePath)
<$> relPathDirToFile
(toRawFilePath templatepath)
(toRawFilePath f)
createDirectoryIfMissing True (takeDirectory destf)
cp f destf
where
@ -187,7 +195,9 @@ installSkelRest topdir _basedir hwcaplibs = do
gapi <- getEnv "GIT_ANNEX_PACKAGE_INSTALL"
writeFile (topdir </> "runshell")
(unlines (map (expandrunshell gapi) runshell))
modifyFileMode (topdir </> "runshell") (addModes executeModes)
modifyFileMode
(toRawFilePath (topdir </> "runshell"))
(addModes executeModes)
where
expandrunshell (Just gapi) l@"GIT_ANNEX_PACKAGE_INSTALL=" = l ++ gapi
-- This is an optimisation, that avoids the linker looking in

View file

@ -13,6 +13,7 @@
-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.RawFilePath (
RawFilePath,

View file

@ -101,3 +101,5 @@ $> git describe
8.20201103-34-gd8e8d145e
```
```
> [[fixed|done]] --[[Joey]]