etc/diskspace: enable removals

[skip ci]
This commit is contained in:
Jens Petersen 2023-06-18 00:24:29 +02:00
parent 2d9b1e1726
commit 7369901a8c
2 changed files with 5 additions and 3 deletions

View File

@ -354,7 +354,7 @@ resolve any issues before the next curator shift the coming monday.
* 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:
* run `./etc/diskspace/clean-old-stack-libs.sh [nightly|lts-XX]`
* run `./etc/diskspace/clean-old-stack-libs.hs [nightly|lts-XX]`
* If that is insufficient then remove all the old builds under the previous ghc/Cabal version:
* `rm -r /var/stackage/stackage/automated/work/[nightly|lts-XX]/unpack-dir/unpacked/*/.stack-work/dist/x86_64-linux/Cabal-X.Y.0.0/`

View File

@ -22,8 +22,9 @@ main = do
home <- getHomeDirectory
withCurrentDirectory (home </> "stackage/automated/work" </> stream </> "unpack-dir") $ do
cleanStackWorkInstall
putStrLn ""
cleanStackWorkPackages
_ -> error "arg should be 'lts' or 'nightly'"
_ -> error "arg should be 'lts-XX' or 'nightly'"
-- navigates to: .stack-work/install/x86_64-linux*/*/*/lib/x86_64-linux-ghc-*
cleanStackWorkInstall :: IO ()
@ -65,7 +66,7 @@ cleanStackWorkInstall =
removeOlder remover files = do
oldfiles <- drop keepBuilds . reverse <$> sortByAge files
mapM_ putStrLn oldfiles
mapM_ remover oldfiles
where
sortByAge files = do
timestamps <- mapM getModificationTime files
@ -79,6 +80,7 @@ removeOlder remover files = do
cleanStackWorkPackages :: IO ()
cleanStackWorkPackages =
withCurrentDirectory "unpacked" $ do
getCurrentDirectory >>= putStrLn
pkgs <- listDirectory "."
forM_ pkgs $ \pkg -> do
withCurrentDirectory $ pkg </> ".stack-work/dist/x86_64-linux-tinfo6"