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

View file

@ -24,6 +24,7 @@ import Utility.Path
import Utility.Exception import Utility.Exception
import Utility.Env import Utility.Env
import Utility.Split import Utility.Split
import Utility.FileSystemEncoding
import qualified Data.Map as M import qualified Data.Map as M
import qualified Data.Set as S import qualified Data.Set as S
@ -63,7 +64,7 @@ installLibs appbase installedbins replacement_libs libmap = do
ifM (doesFileExist dest) ifM (doesFileExist dest)
( return Nothing ( return Nothing
, do , do
createDirectoryIfMissing True (parentDir dest) createDirectoryIfMissing True (fromRawFilePath (parentDir (toRawFilePath dest)))
putStrLn $ "installing " ++ pathlib ++ " as " ++ shortlib putStrLn $ "installing " ++ pathlib ++ " as " ++ shortlib
unlessM (boolSystem "cp" [File pathlib, File dest] unlessM (boolSystem "cp" [File pathlib, File dest]
<&&> boolSystem "chmod" [Param "644", 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.SafeCommand
import Utility.Process import Utility.Process
import Utility.Path import Utility.Path
import Utility.Path.AbsRel
import Utility.Directory import Utility.Directory
import Utility.Env import Utility.Env
import Utility.FileSystemEncoding
import Build.BundledPrograms import Build.BundledPrograms
#ifdef darwin_HOST_OS #ifdef darwin_HOST_OS
import System.IO import System.IO
@ -71,8 +73,10 @@ installGitLibs topdir = do
execpath <- getgitpath "exec-path" execpath <- getgitpath "exec-path"
cfs <- dirContents execpath cfs <- dirContents execpath
forM_ cfs $ \f -> do forM_ cfs $ \f -> do
destf <- (gitcoredestdir </>) destf <- ((gitcoredestdir </>) . fromRawFilePath)
<$> relPathDirToFile execpath f <$> relPathDirToFile
(toRawFilePath execpath)
(toRawFilePath f)
createDirectoryIfMissing True (takeDirectory destf) createDirectoryIfMissing True (takeDirectory destf)
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f
if issymlink if issymlink
@ -96,8 +100,10 @@ installGitLibs topdir = do
createDirectoryIfMissing True (takeDirectory linktarget') createDirectoryIfMissing True (takeDirectory linktarget')
L.readFile f >>= L.writeFile linktarget' L.readFile f >>= L.writeFile linktarget'
removeWhenExistsWith removeLink destf removeWhenExistsWith removeLink destf
rellinktarget <- relPathDirToFile (takeDirectory destf) linktarget' rellinktarget <- relPathDirToFile
createSymbolicLink rellinktarget destf (toRawFilePath (takeDirectory destf))
(toRawFilePath linktarget')
createSymbolicLink (fromRawFilePath rellinktarget) destf
else cp f destf else cp f destf
-- install git's template files -- install git's template files
@ -108,8 +114,10 @@ installGitLibs topdir = do
let templatepath = manpath </> ".." </> "git-core" </> "templates" let templatepath = manpath </> ".." </> "git-core" </> "templates"
tfs <- dirContents templatepath tfs <- dirContents templatepath
forM_ tfs $ \f -> do forM_ tfs $ \f -> do
destf <- (templatedestdir </>) destf <- ((templatedestdir </>) . fromRawFilePath)
<$> relPathDirToFile templatepath f <$> relPathDirToFile
(toRawFilePath templatepath)
(toRawFilePath f)
createDirectoryIfMissing True (takeDirectory destf) createDirectoryIfMissing True (takeDirectory destf)
cp f destf cp f destf
where where
@ -187,7 +195,9 @@ installSkelRest topdir _basedir hwcaplibs = do
gapi <- getEnv "GIT_ANNEX_PACKAGE_INSTALL" gapi <- getEnv "GIT_ANNEX_PACKAGE_INSTALL"
writeFile (topdir </> "runshell") writeFile (topdir </> "runshell")
(unlines (map (expandrunshell gapi) runshell)) (unlines (map (expandrunshell gapi) runshell))
modifyFileMode (topdir </> "runshell") (addModes executeModes) modifyFileMode
(toRawFilePath (topdir </> "runshell"))
(addModes executeModes)
where where
expandrunshell (Just gapi) l@"GIT_ANNEX_PACKAGE_INSTALL=" = l ++ gapi expandrunshell (Just gapi) l@"GIT_ANNEX_PACKAGE_INSTALL=" = l ++ gapi
-- This is an optimisation, that avoids the linker looking in -- This is an optimisation, that avoids the linker looking in

View file

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

View file

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