From 2d9b1e17264bd6860e409db14658bdb5a100f999 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Sun, 18 Jun 2023 00:18:18 +0200 Subject: [PATCH] etc/diskspace: testing + tweaks [skip ci] --- etc/diskspace/remove-old-stack-work-libs.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/diskspace/remove-old-stack-work-libs.hs b/etc/diskspace/remove-old-stack-work-libs.hs index 5932188f..3d03bacb 100755 --- a/etc/diskspace/remove-old-stack-work-libs.hs +++ b/etc/diskspace/remove-old-stack-work-libs.hs @@ -33,6 +33,7 @@ cleanStackWorkInstall = $ withOneDirectory_ -- hash $ withOneDirectory $ \ghcver -> withCurrentDirectory ("lib" "x86_64-linux-ghc-" ++ ghcver) $ do + getCurrentDirectory >>= putStrLn files <- sort <$> listDirectory "." let (dynlibs,libdirs) = partition (".so" `isExtensionOf`) files pkglibdirs = groupBy samePkgLibDir libdirs @@ -64,7 +65,7 @@ cleanStackWorkInstall = removeOlder remover files = do oldfiles <- drop keepBuilds . reverse <$> sortByAge files - mapM_ remover oldfiles + mapM_ putStrLn oldfiles where sortByAge files = do timestamps <- mapM getModificationTime files @@ -80,12 +81,13 @@ cleanStackWorkPackages = withCurrentDirectory "unpacked" $ do pkgs <- listDirectory "." forM_ pkgs $ \pkg -> do - withCurrentDirectory ".stack-work/dist/x86_64-linux-tinfo6" + withCurrentDirectory $ pkg ".stack-work/dist/x86_64-linux-tinfo6" $ withOneDirectory_ -- "Cabal-3.8.1.0" $ withCurrentDirectory "build" $ do ls <- sort <$> listDirectory "." files <- filterM doesFileExist ls - let (dynlibs,statlibs) = partition (".so" `isExtensionOf`) files + let (dynlibs,others) = partition (".so" `isExtensionOf`) files + statlibs = filter (".a" `isExtensionOf`) others removeOlder removeFile dynlibs removeOlder removeFile statlibs