make /usr/lib consolidation more robust
Directory enumeration could happen in either order, and also there could be some other directories so the two to combine are not adjacent.
This commit is contained in:
parent
5feaef773d
commit
6cb08876f0
1 changed files with 8 additions and 13 deletions
|
@ -68,24 +68,19 @@ mklibs top _installedbins = do
|
||||||
- and improves startup time.
|
- and improves startup time.
|
||||||
-}
|
-}
|
||||||
consolidateUsrLib :: FilePath -> [FilePath] -> IO [FilePath]
|
consolidateUsrLib :: FilePath -> [FilePath] -> IO [FilePath]
|
||||||
consolidateUsrLib top libdirs = map reverse <$> go [] (map reverse libdirs)
|
consolidateUsrLib top libdirs = go [] libdirs
|
||||||
where
|
where
|
||||||
go c [] = return c
|
go c [] = return c
|
||||||
go c (x:[]) = return (x:c)
|
go c (x:rest) = case filter (\d -> ("/usr" ++ d) == x) libdirs of
|
||||||
go c (x:y:rest)
|
(d:_) -> do
|
||||||
| x == y ++ reverse ("/usr") = do
|
fs <- getDirectoryContents (inTop top x)
|
||||||
let x' = reverse x
|
|
||||||
let y' = reverse y
|
|
||||||
fs <- getDirectoryContents (inTop top x')
|
|
||||||
forM_ fs $ \f ->
|
forM_ fs $ \f ->
|
||||||
unless (dirCruft f) $
|
unless (dirCruft f) $
|
||||||
renameFile
|
renameFile
|
||||||
(inTop top (x' </> f))
|
(inTop top (x </> f))
|
||||||
(inTop top (y' </> f))
|
(inTop top (d </> f))
|
||||||
go (y:c) rest
|
go c rest
|
||||||
| otherwise = do
|
_ -> go (x:c) rest
|
||||||
print (x,y)
|
|
||||||
go (x:c) (y:rest)
|
|
||||||
|
|
||||||
{- Installs a linker shim script around a binary.
|
{- Installs a linker shim script around a binary.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue