refactor(Debug output for finding the reason for empty language list)

This commit is contained in:
Stephan Barth 2024-03-31 01:08:56 +01:00
parent 1fd5f5bf08
commit 0d84d3650a
3 changed files with 50 additions and 26 deletions

View File

@ -295,11 +295,11 @@
"hackage": {
"flake": false,
"locked": {
"lastModified": 1705537393,
"narHash": "sha256-MEaafajuZWk2e2DcI0u4g+9H6eoBYfNGu8JNvDfpSz8=",
"lastModified": 1708993343,
"narHash": "sha256-8EbbR5ReQK61yP/7VYtFSCerBXSE59VtfV+Wahdsuqg=",
"owner": "input-output-hk",
"repo": "hackage.nix",
"rev": "c66ea06697f6404c27065822f21ed0d30017c2c9",
"rev": "f823c9258e9316cb4da256fc93e9c0407f0c296a",
"type": "github"
},
"original": {
@ -330,6 +330,7 @@
"hpc-coveralls": "hpc-coveralls",
"hydra": "hydra",
"iserv-proxy": "iserv-proxy",
"nix-tools-static": "nix-tools-static",
"nixpkgs": [
"haskell-nix",
"nixpkgs-unstable"
@ -346,11 +347,11 @@
"stackage": "stackage"
},
"locked": {
"lastModified": 1705539027,
"narHash": "sha256-wvGY2BGV4qSL/UVxPNVVQf7d+XZXg4Jmd1VgL8k/Iz8=",
"lastModified": 1708994988,
"narHash": "sha256-GQD4phMqbuEmSvUpcmTp1W9InABwuegI4EFhBOyMM8Q=",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "57df03d26d5af4838d675df555af3c838d356a85",
"rev": "edd4f75235c050c0ee476e1fe28f757b068cf465",
"type": "github"
},
"original": {
@ -587,11 +588,11 @@
"minio-hs": {
"flake": false,
"locked": {
"lastModified": 1705540966,
"narHash": "sha256-qkB2KfYPZEBvSm/zZZANkbzJmuorXyG3FxpZQ1lacaw=",
"lastModified": 1705548354,
"narHash": "sha256-wuJYScDu1hGlasE4rzUEi9ouvEiQYWcHF9jRngiQ3Z4=",
"ref": "uni2work",
"rev": "3dcb2765211aca4ef240fa4e89e297211f07ad6c",
"revCount": 222,
"rev": "fafc203e1bace1998264d1ce4340fb801e877b51",
"revCount": 223,
"type": "git",
"url": "https://gitlab.uniworx.de/haskell/minio-hs.git"
},
@ -622,6 +623,23 @@
"type": "github"
}
},
"nix-tools-static": {
"flake": false,
"locked": {
"lastModified": 1706266250,
"narHash": "sha256-9t+GRk3eO9muCtKdNAwBtNBZ5dH1xHcnS17WaQyftwA=",
"owner": "input-output-hk",
"repo": "haskell-nix-example",
"rev": "580cb6db546a7777dad3b9c0fa487a366c045c4e",
"type": "github"
},
"original": {
"owner": "input-output-hk",
"ref": "nix",
"repo": "haskell-nix-example",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1657693803,
@ -856,11 +874,11 @@
"stackage": {
"flake": false,
"locked": {
"lastModified": 1705536588,
"narHash": "sha256-p346EK20jmSALUlWOHBvkTFhLUa2IK28Vfunw7Es1Qg=",
"lastModified": 1708992583,
"narHash": "sha256-g9sClypeNUzEjc2aFaTyaptFc5dXt3zA3HnfRV5AN2g=",
"owner": "input-output-hk",
"repo": "stackage.nix",
"rev": "967f15b4a78ff4af2c7000fd770b088da7986230",
"rev": "08e1deb077c113cde815daa21683c7fbc71ee4aa",
"type": "github"
},
"original": {
@ -904,11 +922,11 @@
"yesod": {
"flake": false,
"locked": {
"lastModified": 1625061191,
"narHash": "sha256-K0X2MwUStChml1DlJ7t4yBMDwrMe6j/780nJtSy9Hss=",
"lastModified": 1705542497,
"narHash": "sha256-DYri6G3LeL3Gu11K0gAcUOxMwyKrLVkNnb5oTjHKRro=",
"ref": "uni2work",
"rev": "a59f63e0336ee61f7a90b8778e9147305d3127bb",
"revCount": 5053,
"rev": "9f8d26371d4760f8985e7bbe00c3ac16be1301bc",
"revCount": 5208,
"type": "git",
"url": "https://gitlab.uniworx.de/haskell/yesod.git"
},

View File

@ -275,7 +275,10 @@ in pkgs.mkShell {
'';
nativeBuildInputs = [develop inDevelop killallUni2work diffRunning]
++ (with pkgs;
[ stdenv coreutils stack nodejs_21 postgresql_12 openldap exiftool expat bzip2 glibc memcached minio minio-client
[ stdenv coreutils stack nodejs_21 postgresql_12 openldap exiftool
# expat bzip2 # these two were making problems in the ghc-versionbump to GHC9
expat bzip2
glibc memcached minio minio-client
gup reuse pre-commit
# busybox # for print services, but interferes with build commands in develop-shell
htop
@ -291,5 +294,5 @@ in pkgs.mkShell {
;
})
]
) ++ (with pkgs.haskellPackages; [ yesod-bin hlint cabal-install weeder ]);
) ++ (with pkgs.haskellPackages; [ yesod-bin hlint cabal-install weeder hexpat bzlib ]);
}

View File

@ -42,6 +42,8 @@ import Text.Blaze.Html (preEscapedToHtml)
import Control.Monad.Fail
import qualified Debug.Trace as Trace
nWellKnownFileName :: Name
nWellKnownFileName = mkName "WellKnownFileName"
@ -77,31 +79,32 @@ mkWellKnown defLang wellKnownBase wellKnownLinks = do
File{..} <- pure pFile
guard $ name /= wellKnownLinks
return $ file & _1 %~ makeRelative (wellKnownBase </> language)
return (Text.pack language, lContents')
return (Trace.trace ("### Trace language: (" ++ show language ++ ")") (Text.pack language, lContents'))
| otherwise
-> fail "wellKnownBase is not a directory"
-> fail $ "wellKnownBase (" ++ wellKnownBase ++ ") is not a directory"
fLanguages <- if
| defLang `Set.member` Map.keysSet languageFiles
, let languages' = Set.delete defLang $ Map.keysSet languageFiles
-> return $ defLang :| Set.toList languages'
-> return $ Trace.trace ("### fLanguages: (" ++ show languages' ++ ")") (defLang :| Set.toList languages')
| otherwise
-> fail "default language is missing in wellKnownBase"
-- languageLinks :: Map Lang ByteString
languageLinks <- if
| Dir{contents} <- inputFiles
-> return . Map.fromList $ do
-- -> Trace.trace ("### Trace languageLinks (outer): (" ++ show contents ++ ")") $ return . Map.fromList $ do
-> Trace.trace ("### Trace languageLinks (outer): (" ++ "...show contents..." ++ ")") $ return . Map.fromList $ do
(language, lContents) <- contents ^.. folded . $(multifocusL 2) _name id
Dir{} <- pure lContents
Dir{} <- Trace.trace ("### Trace languageLinks (inner1): (" ++ show language ++ ")") $ pure lContents
let
lContents' :: [ByteString]
lContents' = flip mapMaybe (flattenDir lContents) $ \pFile -> do
lContents' = Trace.traceShowId $ flip mapMaybe (flattenDir lContents) $ \pFile -> do
File{..} <- pure pFile
guard $ name == wellKnownLinks
return $ file ^. _2
c <- lContents'
return (Text.pack language, c)
return (Trace.trace ("### Trace languageLinks (inner): (" ++ show language ++ ")") (Text.pack language, c))
| otherwise
-> fail "wellKnownBase is not a directory"