Merge branch 'master' into ospath

This commit is contained in:
Joey Hess 2025-01-29 18:48:02 -04:00
commit 97c83152d6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 23 additions and 19 deletions

View file

@ -26,11 +26,12 @@ import Utility.Path.AbsRel
import Utility.FileMode import Utility.FileMode
import Utility.CopyFile import Utility.CopyFile
import Utility.FileSystemEncoding import Utility.FileSystemEncoding
import Utility.SystemDirectory
mklibs :: FilePath -> a -> IO Bool mklibs :: FilePath -> a -> IO Bool
mklibs top _installedbins = do mklibs top _installedbins = do
fs <- dirContentsRecursive top fs <- dirContentsRecursive (toRawFilePath top)
exes <- filterM checkExe fs exes <- filterM checkExe (map fromRawFilePath fs)
libs <- runLdd exes libs <- runLdd exes
glibclibs <- glibcLibs glibclibs <- glibcLibs

View file

@ -25,6 +25,7 @@ import Utility.Path.AbsRel
import Utility.Directory import Utility.Directory
import Utility.Env import Utility.Env
import Utility.FileSystemEncoding import Utility.FileSystemEncoding
import Utility.SystemDirectory
import Build.BundledPrograms import Build.BundledPrograms
#ifdef darwin_HOST_OS #ifdef darwin_HOST_OS
import System.IO import System.IO
@ -71,14 +72,15 @@ installGitLibs topdir = do
-- install git-core programs; these are run by the git command -- install git-core programs; these are run by the git command
createDirectoryIfMissing True gitcoredestdir createDirectoryIfMissing True gitcoredestdir
execpath <- getgitpath "exec-path" execpath <- getgitpath "exec-path"
cfs <- dirContents execpath cfs <- dirContents (toRawFilePath execpath)
forM_ cfs $ \f -> do forM_ cfs $ \f -> do
let f' = fromRawFilePath f
destf <- ((gitcoredestdir </>) . fromRawFilePath) destf <- ((gitcoredestdir </>) . fromRawFilePath)
<$> relPathDirToFile <$> relPathDirToFile
(toRawFilePath execpath) (toRawFilePath execpath)
(toRawFilePath f) f
createDirectoryIfMissing True (takeDirectory destf) createDirectoryIfMissing True (takeDirectory destf)
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f'
if issymlink if issymlink
then do then do
-- many git-core files may symlink to eg -- many git-core files may symlink to eg
@ -91,20 +93,20 @@ installGitLibs topdir = do
-- Other git-core files symlink to a file -- Other git-core files symlink to a file
-- beside them in the directory. Those -- beside them in the directory. Those
-- links can be copied as-is. -- links can be copied as-is.
linktarget <- readSymbolicLink f linktarget <- readSymbolicLink f'
if takeFileName linktarget == linktarget if takeFileName linktarget == linktarget
then cp f destf then cp f' destf
else do else do
let linktarget' = progDir topdir </> takeFileName linktarget let linktarget' = progDir topdir </> takeFileName linktarget
unlessM (doesFileExist linktarget') $ do unlessM (doesFileExist linktarget') $ 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 rellinktarget <- relPathDirToFile
(toRawFilePath (takeDirectory destf)) (toRawFilePath (takeDirectory destf))
(toRawFilePath linktarget') (toRawFilePath linktarget')
createSymbolicLink (fromRawFilePath rellinktarget) destf createSymbolicLink (fromRawFilePath rellinktarget) destf
else cp f destf else cp f' destf
-- install git's template files -- install git's template files
-- git does not have an option to get the path of these, -- 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 -- next to the --man-path, in eg /usr/share/git-core
manpath <- getgitpath "man-path" manpath <- getgitpath "man-path"
let templatepath = manpath </> ".." </> "git-core" </> "templates" let templatepath = manpath </> ".." </> "git-core" </> "templates"
tfs <- dirContents templatepath tfs <- dirContents (toRawFilePath templatepath)
forM_ tfs $ \f -> do forM_ tfs $ \f -> do
destf <- ((templatedestdir </>) . fromRawFilePath) destf <- ((templatedestdir </>) . fromRawFilePath)
<$> relPathDirToFile <$> relPathDirToFile
(toRawFilePath templatepath) (toRawFilePath templatepath)
(toRawFilePath f) f
createDirectoryIfMissing True (takeDirectory destf) createDirectoryIfMissing True (takeDirectory destf)
cp f destf cp (fromRawFilePath f) destf
where where
gitcoredestdir = topdir </> "git-core" gitcoredestdir = topdir </> "git-core"
templatedestdir = topdir </> "templates" templatedestdir = topdir </> "templates"

View file

@ -5,7 +5,6 @@
- Licensed under the GNU AGPL version 3 or higher. - Licensed under the GNU AGPL version 3 or higher.
-} -}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Git.HashObject where module Git.HashObject where

View file

@ -333,12 +333,14 @@ Executable git-annex
P2P.Http.State P2P.Http.State
if flag(OsPath) if flag(OsPath)
Build-Depends: -- Currently this build flag does not pass the test suite on Windows
os-string (>= 2.0.0), if (! os(windows))
directory (>= 1.3.8.3), Build-Depends:
filepath (>= 1.5.2.0), os-string (>= 2.0.0),
file-io (>= 0.1.3) directory (>= 1.3.8.3),
CPP-Options: -DWITH_OSPATH filepath (>= 1.5.2.0),
file-io (>= 0.1.3)
CPP-Options: -DWITH_OSPATH
if (os(windows)) if (os(windows))
Build-Depends: Build-Depends: