This commit is contained in:
Julian Ospald 2022-09-22 00:03:26 +08:00
parent 81c7f6a32a
commit 3f968cb1c0
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
2 changed files with 18 additions and 2 deletions

View File

@ -360,13 +360,18 @@ deriving instance Show InstallSetError
-- | A build failed.
data BuildFailed = forall es . (ToVariantMaybe BuildFailed es, PopVariant BuildFailed es, Pretty (V es), Show (V es)) => BuildFailed FilePath (V es)
data BuildFailed = forall es . (ToVariantMaybe BuildFailed es, PopVariant BuildFailed es, Pretty (V es), Show (V es)) => BuildFailed FilePath (V es) (Just Requirements)
instance Pretty BuildFailed where
pPrint (BuildFailed path reason) =
pPrint (BuildFailed path reason req) =
case reason of
VMaybe (_ :: BuildFailed) -> pPrint reason
_ -> text "BuildFailed failed in dir" <+> text (path <> ":") <+> pPrint reason
<+> printToolReq'
where
printToolReq' = case req of
Nothing -> T.pack ""
Just req' -> prettyRequirementsError req'
deriving instance Show BuildFailed

View File

@ -68,6 +68,17 @@ prettyRequirements Requirements {..} =
n = if not . T.null $ _notes then "\n Note: " <> _notes else ""
in "System requirements " <> d <> n
prettyRequirementsError :: Requirements -> T.Text
prettyRequirementsError Requirements {..} =
let d = if not . null $ _distroPKGs
then "\nMake sure the following distro packages "
<> "are installed: "
<> T.intercalate " " _distroPKGs
else ""
n = if not . T.null $ _notes then "\nMake sure the following requirements are met: " <> _notes else ""
in d <> n
rawRequirements :: Requirements -> T.Text
rawRequirements Requirements {..} =
if not . null $ _distroPKGs