mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-12 07:18:31 +01:00
Merge branch 'master' into add-it-has
This commit is contained in:
commit
fc7365a4fa
@ -466,7 +466,7 @@ packages:
|
||||
|
||||
"Li-yao Xia <lysxia@gmail.com> @Lysxia":
|
||||
- boltzmann-samplers
|
||||
- first-class-families < 0.8.0.0
|
||||
- first-class-families
|
||||
- generic-data
|
||||
- generic-data-surgery < 0 # via generic-data
|
||||
- generic-random
|
||||
@ -862,7 +862,7 @@ packages:
|
||||
- compensated
|
||||
- compressed < 0
|
||||
- concurrent-supply
|
||||
- constraints < 0.12 # https://github.com/commercialhaskell/stackage/issues/5124
|
||||
- constraints
|
||||
- contravariant
|
||||
- distributive
|
||||
- discrimination < 0
|
||||
@ -3865,10 +3865,10 @@ packages:
|
||||
- map-syntax < 0 # GHC 8.4 via base-4.11.0.0
|
||||
- heist < 0 # GHC 8.4 via map-syntax
|
||||
- snap < 0 # GHC 8.4 via base-4.11.0.0
|
||||
- conferer
|
||||
- conferer < 0.4.0.0 # https://github.com/commercialhaskell/stackage/issues/5374
|
||||
# - conferer-snap # Because snap
|
||||
- conferer-warp
|
||||
- conferer-hspec
|
||||
- conferer-warp < 0.4.0.0 # https://github.com/commercialhaskell/stackage/issues/5374
|
||||
- conferer-hspec < 0.4.0.0 # https://github.com/commercialhaskell/stackage/issues/5374
|
||||
- conferer-provider-json
|
||||
|
||||
"Tim Humphries <tim+stackage@utf8.me> @thumphries":
|
||||
@ -4245,6 +4245,9 @@ packages:
|
||||
"Dobromir Nikolov <dnikolovv@hotmail.com> @dnikolovv":
|
||||
- it-has
|
||||
|
||||
"Gabriele Sales <gbrsales@gmail.com> @gbrsales":
|
||||
- cabal-appimage
|
||||
|
||||
"Grandfathered dependencies":
|
||||
- network
|
||||
- Boolean
|
||||
|
||||
55
etc/diskspace/remove-old-stack-work-libs.hs
Executable file
55
etc/diskspace/remove-old-stack-work-libs.hs
Executable file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env stack
|
||||
-- stack --resolver lts-14 script
|
||||
|
||||
-- Utility to remove old libs installed under .stack-work/ to save diskspace
|
||||
|
||||
-- Should be run in:
|
||||
-- work/*/unpack-dir/.stack-work/install/x86_64-linux/*/*/lib/x86_64-linux-ghc-*
|
||||
|
||||
import Data.List
|
||||
import System.Directory
|
||||
|
||||
main = do
|
||||
files <- sort <$> listDirectory "."
|
||||
(libdirs,dynlibs) <- partitionM doesDirectoryExist files
|
||||
let pkglibdirs = groupBy samePkgLibDir libdirs
|
||||
pkgdynlibs = groupBy samePkgDynLib dynlibs
|
||||
mapM_ (removeOlder removeDirectoryRecursive) pkglibdirs
|
||||
mapM_ (removeOlder removeFile) pkgdynlibs
|
||||
where
|
||||
samePkgLibDir l1 l2 = pkgDirName l1 == pkgDirName l2
|
||||
where
|
||||
pkgDirName p =
|
||||
if countDashes p < 2
|
||||
then error $ p ++ " not in name-version-hash format"
|
||||
else (removeDashSegment . removeDashSegment) p
|
||||
|
||||
countDashes = length . filter (== '-')
|
||||
|
||||
removeDashSegment = init . dropWhileEnd (/= '-')
|
||||
|
||||
samePkgDynLib d1 d2 = pkgDynName d1 == pkgDynName d2
|
||||
where
|
||||
pkgDynName p =
|
||||
if countDashes p < 3
|
||||
then error $ p ++ " not in libname-version-hash-ghc*.so format"
|
||||
else (removeDashSegment . removeDashSegment . removeDashSegment) p
|
||||
|
||||
removeOlder remover files = do
|
||||
oldfiles <- drop 2 . reverse <$> sortByAge files
|
||||
mapM_ remover oldfiles
|
||||
|
||||
sortByAge files = do
|
||||
timestamps <- mapM getModificationTime files
|
||||
let fileTimes = zip files timestamps
|
||||
return $ map fst $ sortBy compareSnd fileTimes
|
||||
|
||||
compareSnd (_,t1) (_,t2) = compare t1 t2
|
||||
|
||||
-- borrowed from Control.Monad.Extra
|
||||
partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a])
|
||||
partitionM f [] = pure ([], [])
|
||||
partitionM f (x:xs) = do
|
||||
res <- f x
|
||||
(as,bs) <- partitionM f xs
|
||||
pure ([x | res]++as, [x | not res]++bs)
|
||||
Loading…
Reference in New Issue
Block a user