Linux standalone: Avoid using hard links in the tarball so it can be untarred on eg, afs which does not support them.
This commit is contained in:
parent
c0d93f678e
commit
d48f4caaef
4 changed files with 30 additions and 12 deletions
|
@ -34,7 +34,6 @@ main = getArgs >>= go
|
||||||
mklibs :: FilePath -> IO ()
|
mklibs :: FilePath -> IO ()
|
||||||
mklibs top = do
|
mklibs top = do
|
||||||
fs <- dirContentsRecursive top
|
fs <- dirContentsRecursive top
|
||||||
mapM_ symToHardLink fs
|
|
||||||
exes <- filterM checkExe fs
|
exes <- filterM checkExe fs
|
||||||
libs <- parseLdd <$> readProcess "ldd" exes
|
libs <- parseLdd <$> readProcess "ldd" exes
|
||||||
glibclibs <- glibcLibs
|
glibclibs <- glibcLibs
|
||||||
|
@ -63,7 +62,18 @@ installLinkerShim :: FilePath -> FilePath -> FilePath -> IO ()
|
||||||
installLinkerShim top linker exe = do
|
installLinkerShim top linker exe = do
|
||||||
createDirectoryIfMissing True (top </> shimdir)
|
createDirectoryIfMissing True (top </> shimdir)
|
||||||
createDirectoryIfMissing True (top </> exedir)
|
createDirectoryIfMissing True (top </> exedir)
|
||||||
renameFile exe exedest
|
ifM (isSymbolicLink <$> getSymbolicLinkStatus exe)
|
||||||
|
( do
|
||||||
|
sl <- readSymbolicLink exe
|
||||||
|
nukeFile exe
|
||||||
|
nukeFile exedest
|
||||||
|
-- Assume that for a symlink, the destination
|
||||||
|
-- will also be shimmed.
|
||||||
|
let sl' = ".." </> takeFileName sl </> takeFileName sl
|
||||||
|
print (sl', exedest)
|
||||||
|
createSymbolicLink sl' exedest
|
||||||
|
, renameFile exe exedest
|
||||||
|
)
|
||||||
link <- relPathDirToFile (top </> exedir) (top ++ linker)
|
link <- relPathDirToFile (top </> exedir) (top ++ linker)
|
||||||
unlessM (doesFileExist (top </> exelink)) $
|
unlessM (doesFileExist (top </> exelink)) $
|
||||||
createSymbolicLink link (top </> exelink)
|
createSymbolicLink link (top </> exelink)
|
||||||
|
@ -81,15 +91,6 @@ installLinkerShim top linker exe = do
|
||||||
exedest = top </> shimdir </> base
|
exedest = top </> shimdir </> base
|
||||||
exelink = exedir </> base
|
exelink = exedir </> base
|
||||||
|
|
||||||
{- Converting symlinks to hard links simplifies the binary shimming
|
|
||||||
- process. -}
|
|
||||||
symToHardLink :: FilePath -> IO ()
|
|
||||||
symToHardLink f = whenM (isSymbolicLink <$> getSymbolicLinkStatus f) $ do
|
|
||||||
l <- readSymbolicLink f
|
|
||||||
let absl = absPathFrom (parentDir f) l
|
|
||||||
nukeFile f
|
|
||||||
createLink absl f
|
|
||||||
|
|
||||||
installFile :: FilePath -> FilePath -> IO ()
|
installFile :: FilePath -> FilePath -> IO ()
|
||||||
installFile top f = do
|
installFile top f = do
|
||||||
createDirectoryIfMissing True destdir
|
createDirectoryIfMissing True destdir
|
||||||
|
@ -101,7 +102,7 @@ checkExe :: FilePath -> IO Bool
|
||||||
checkExe f
|
checkExe f
|
||||||
| ".so" `isSuffixOf` f = return False
|
| ".so" `isSuffixOf` f = return False
|
||||||
| otherwise = ifM (isExecutable . fileMode <$> getFileStatus f)
|
| otherwise = ifM (isExecutable . fileMode <$> getFileStatus f)
|
||||||
( checkFileExe <$> readProcess "file" [f]
|
( checkFileExe <$> readProcess "file" ["-L", f]
|
||||||
, return False
|
, return False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ git-annex (6.20161032) UNRELEASED; urgency=medium
|
||||||
* webapp: Explicitly avoid checking for auth in static subsite
|
* webapp: Explicitly avoid checking for auth in static subsite
|
||||||
requests. Yesod didn't used to do auth checks for that, but this may
|
requests. Yesod didn't used to do auth checks for that, but this may
|
||||||
have changed.
|
have changed.
|
||||||
|
* Linux standalone: Avoid using hard links in the tarball so it can be
|
||||||
|
untarred on eg, afs which does not support them.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 01 Nov 2016 14:02:06 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 01 Nov 2016 14:02:06 -0400
|
||||||
|
|
||||||
|
|
|
@ -20,3 +20,5 @@ ls: cannot access git-annex.linux/shimmed/git-pack-redundant/git-pack-redundant:
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
|
|
||||||
|
> [[done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 3"""
|
||||||
|
date="2016-11-10T18:21:35Z"
|
||||||
|
content="""
|
||||||
|
Bloating the tarball with duplicates of all the hard linked stuff would
|
||||||
|
increase its size by a large amount.
|
||||||
|
|
||||||
|
The current machinery for building the standlone tarball only works when
|
||||||
|
using hard links.
|
||||||
|
|
||||||
|
Ok.. Complicated it by making it use symlinks.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue