diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-11-10 15:12:08 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-11-10 15:12:30 -0400 |
commit | a992345dc5ecedc17093cca8f7a57256f4106476 (patch) | |
tree | 085ba1a78a8ca11d2af69f9edd9b6ef9c11a0f30 | |
parent | a2540dfad8e1c7b98ff96a6ba81ff9d2921344a3 (diff) |
Linux standalone: Avoid using hard links in the tarball so it can be untarred on eg, afs which does not support them.
4 files changed, 30 insertions, 12 deletions
diff --git a/Build/LinuxMkLibs.hs b/Build/LinuxMkLibs.hs index f50b1cbfc..d7512bfe0 100644 --- a/Build/LinuxMkLibs.hs +++ b/Build/LinuxMkLibs.hs @@ -34,7 +34,6 @@ main = getArgs >>= go mklibs :: FilePath -> IO () mklibs top = do fs <- dirContentsRecursive top - mapM_ symToHardLink fs exes <- filterM checkExe fs libs <- parseLdd <$> readProcess "ldd" exes glibclibs <- glibcLibs @@ -63,7 +62,18 @@ installLinkerShim :: FilePath -> FilePath -> FilePath -> IO () installLinkerShim top linker exe = do createDirectoryIfMissing True (top </> shimdir) 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) unlessM (doesFileExist (top </> exelink)) $ createSymbolicLink link (top </> exelink) @@ -81,15 +91,6 @@ installLinkerShim top linker exe = do exedest = top </> shimdir </> 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 top f = do createDirectoryIfMissing True destdir @@ -101,7 +102,7 @@ checkExe :: FilePath -> IO Bool checkExe f | ".so" `isSuffixOf` f = return False | otherwise = ifM (isExecutable . fileMode <$> getFileStatus f) - ( checkFileExe <$> readProcess "file" [f] + ( checkFileExe <$> readProcess "file" ["-L", f] , return False ) @@ -16,6 +16,8 @@ git-annex (6.20161032) UNRELEASED; urgency=medium * webapp: Explicitly avoid checking for auth in static subsite requests. Yesod didn't used to do auth checks for that, but this may 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 diff --git a/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount.mdwn b/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount.mdwn index 443b3827b..32643a612 100644 --- a/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount.mdwn +++ b/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount.mdwn @@ -20,3 +20,5 @@ ls: cannot access git-annex.linux/shimmed/git-pack-redundant/git-pack-redundant: """]] [[!meta author=yoh]] + +> [[done]] --[[Joey]] diff --git a/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount/comment_3_c200ccb58cf3e53dd162884e0568429e._comment b/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount/comment_3_c200ccb58cf3e53dd162884e0568429e._comment new file mode 100644 index 000000000..0a53ac4d6 --- /dev/null +++ b/doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount/comment_3_c200ccb58cf3e53dd162884e0568429e._comment @@ -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. +"""]] |