Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Koz Ross 2020-05-22 08:46:44 +12:00
commit c714bc18c8
4 changed files with 42 additions and 33 deletions

View File

@ -335,9 +335,9 @@ LTS minor bumps typically are run on Sundays.
### Diskspace errors (and website sync debugging) ### Diskspace errors (and website sync debugging)
* You can detect the problem by running `df`. If you see that `/` is out of space, we have a problem * You can detect the problem by running `df`. If you see that `/` is out of space, we have a problem.
* If you see that `/var/stackage/` is out of space, you can: * If you see that `/var/stackage/` is out of space, you can:
* run `./stackage/etc/diskspace/remove-old-stack-work-libs.hs` in `/var/stackage/stackage/automated/work/*/unpack-dir/.stack-work/install/x86_64-linux/*/*/` (hopefully sufficient) * run `./etc/diskspace/clean-old-stack-libs.sh [nightly|lts-XX]` (hopefully sufficient)
optionally (not recommended?): optionally (not recommended?):
* `rm -r /var/stackage/stackage/automated/work/lts*/unpack-dir/unpacked/` * `rm -r /var/stackage/stackage/automated/work/lts*/unpack-dir/unpacked/`

View File

@ -86,7 +86,7 @@ packages:
"Robert Vollmert <rob@vllmrt.net> @robx": "Robert Vollmert <rob@vllmrt.net> @robx":
- configurator-pg - configurator-pg
- postgrest - postgrest < 7.0.1 # https://github.com/commercialhaskell/stackage/issues/5383
"Sandy Maguire <sandy@sandymaguire.me> @isovector": "Sandy Maguire <sandy@sandymaguire.me> @isovector":
- ecstasy - ecstasy
@ -2589,7 +2589,7 @@ packages:
- mighty-metropolis - mighty-metropolis
- speedy-slice - speedy-slice
- hasty-hamiltonian - hasty-hamiltonian
- declarative - declarative < 0.5.2 # https://github.com/commercialhaskell/stackage/issues/5384
- sampling - sampling
- flat-mcmc - flat-mcmc
- urbit-hob - urbit-hob
@ -3266,7 +3266,7 @@ packages:
- validation - validation
"Tony Day <tonyday567@gmail.com> @tonyday567": "Tony Day <tonyday567@gmail.com> @tonyday567":
- numhask - numhask < 0.5 # https://github.com/commercialhaskell/stackage/issues/5382
- numhask-array < 0 - numhask-array < 0
- numhask-prelude < 0 - numhask-prelude < 0
- numhask-space < 0 - numhask-space < 0
@ -3625,7 +3625,7 @@ packages:
- ilist - ilist
- life-sync - life-sync
- membrain - membrain
- relude < 0.7 # https://github.com/commercialhaskell/stackage/issues/5361 - relude
- shellmet - shellmet
- shortcut-links - shortcut-links
- summoner - summoner
@ -4038,7 +4038,7 @@ packages:
- secp256k1-haskell - secp256k1-haskell
- rocksdb-haskell - rocksdb-haskell
- rocksdb-query - rocksdb-query
- haskoin-core - haskoin-core < 0.13.5 # https://github.com/haskoin/haskoin-core/issues/385
- haskoin-node - haskoin-node
- haskoin-store < 0 # https://github.com/haskoin/haskoin-store/issues/12 - haskoin-store < 0 # https://github.com/haskoin/haskoin-store/issues/12
@ -4409,6 +4409,7 @@ packages:
- functor-combinators < 0 # via dependent-sum - functor-combinators < 0 # via dependent-sum
- generic-arbitrary - generic-arbitrary
- generics-sop-lens - generics-sop-lens
- ghc-byteorder
- ghc-compact - ghc-compact
- ghc-paths - ghc-paths
- ghc-prof - ghc-prof
@ -4820,15 +4821,9 @@ packages:
# https://github.com/commercialhaskell/stackage/issues/5335 # https://github.com/commercialhaskell/stackage/issues/5335
- brick <0.53 - brick <0.53
# https://github.com/commercialhaskell/stackage/issues/5336
- colourista < 0.1.0.0
# https://github.com/commercialhaskell/stackage/issues/5347 # https://github.com/commercialhaskell/stackage/issues/5347
- persistent-template < 2.8.3 - persistent-template < 2.8.3
# https://github.com/commercialhaskell/stackage/issues/5346
- validation-selective < 0.1.0.0
# https://github.com/commercialhaskell/stackage/issues/5348 # https://github.com/commercialhaskell/stackage/issues/5348
- tasty < 1.3 - tasty < 1.3
- tasty-golden < 2.3.3.3 - tasty-golden < 2.3.3.3
@ -4839,6 +4834,8 @@ packages:
# https://github.com/commercialhaskell/stackage/issues/5351 # https://github.com/commercialhaskell/stackage/issues/5351
- pantry < 0.5 - pantry < 0.5
# https://github.com/commercialhaskell/path/issues/161
- path < 0.7.1
# end of packages # end of packages
# Package flags are applied to individual packages, and override the values of # Package flags are applied to individual packages, and override the values of

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -e
if [ $# != 1 ]; then
echo "Usage: $0 [nightly|lts-xx]"
exit 1
fi
cd ~/stackage/automated/work/$1/unpack-dir/.stack-work/install/x86_64-linux/*/*/lib/x86_64-linux-ghc-*
pwd
stack --resolver lts-14.27 script ~/stackage/etc/diskspace/remove-old-stack-work-libs.hs

37
etc/diskspace/remove-old-stack-work-libs.hs Executable file → Normal file
View File

@ -8,11 +8,13 @@
import Data.List import Data.List
import System.Directory import System.Directory
import System.FilePath
import Text.Regex.TDFA
main = do main = do
files <- sort <$> listDirectory "." files <- sort <$> listDirectory "."
(libdirs,dynlibs) <- partitionM doesDirectoryExist files let (dynlibs,libdirs) = partition (".so" `isExtensionOf`) files
let pkglibdirs = groupBy samePkgLibDir libdirs pkglibdirs = groupBy samePkgLibDir libdirs
pkgdynlibs = groupBy samePkgDynLib dynlibs pkgdynlibs = groupBy samePkgDynLib dynlibs
mapM_ (removeOlder removeDirectoryRecursive) pkglibdirs mapM_ (removeOlder removeDirectoryRecursive) pkglibdirs
mapM_ (removeOlder removeFile) pkgdynlibs mapM_ (removeOlder removeFile) pkgdynlibs
@ -20,22 +22,27 @@ main = do
samePkgLibDir l1 l2 = pkgDirName l1 == pkgDirName l2 samePkgLibDir l1 l2 = pkgDirName l1 == pkgDirName l2
where where
pkgDirName p = pkgDirName p =
if countDashes p < 2 if length p < 25
then error $ p ++ " not in name-version-hash format" then error $ p ++ " too short to be in correct name-version-hash format"
else (removeDashSegment . removeDashSegment) p else extractNameInternal p
countDashes = length . filter (== '-') extractNameInternal :: String -> String
extractNameInternal p =
removeDashSegment = init . dropWhileEnd (/= '-') let (name,match,internal) = p =~ "-[0-9.]+-[0-9A-Za-z]{20,22}" :: (String, String, String)
in if null match || null name then error $ p ++ " not in correct name-version-hash format"
else name ++ internal
samePkgDynLib d1 d2 = pkgDynName d1 == pkgDynName d2 samePkgDynLib d1 d2 = pkgDynName d1 == pkgDynName d2
where where
pkgDynName p = pkgDynName p =
if countDashes p < 3 if length p < 42
then error $ p ++ " not in libname-version-hash-ghc*.so format" then error $ p ++ " too short to be libHSname-version-hash-ghc*.so format"
else (removeDashSegment . removeDashSegment . removeDashSegment) p else (extractNameInternal . removeDashSegment) p
removeDashSegment = dropWhileEnd (/= '-')
removeOlder remover files = do removeOlder remover files = do
-- keep 2 latest builds
oldfiles <- drop 2 . reverse <$> sortByAge files oldfiles <- drop 2 . reverse <$> sortByAge files
mapM_ remover oldfiles mapM_ remover oldfiles
@ -45,11 +52,3 @@ main = do
return $ map fst $ sortBy compareSnd fileTimes return $ map fst $ sortBy compareSnd fileTimes
compareSnd (_,t1) (_,t2) = compare t1 t2 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)