Linux standalone: Avoid using hard links in the tarball so it can be untarred on...
authorJoey Hess <joeyh@joeyh.name>
Thu, 10 Nov 2016 19:12:08 +0000 (15:12 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 10 Nov 2016 19:12:30 +0000 (15:12 -0400)
Build/LinuxMkLibs.hs
CHANGELOG
doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount.mdwn
doc/bugs/cannot___34__install__34___standalone_git_annex_within_afs_mount/comment_3_c200ccb58cf3e53dd162884e0568429e._comment [new file with mode: 0644]

index f50b1cbfc8643d7eba5d37521f9c002a40d33e1d..d7512bfe0f69b0b1e7cd3cbb995cf5d33116601b 100644 (file)
@@ -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
                )
 
index 0981bc5eac69b0b97e191bcfc570f30fc161af3e..ca846cd65b4937e2672f81cac782e11e4023a234 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 
index 443b3827bd1949771e45e178d7aa0ce436679acf..32643a612f318e4cbda13b40c583f0f70a6e0832 100644 (file)
@@ -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 (file)
index 0000000..0a53ac4
--- /dev/null
@@ -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.
+"""]]