maintainers/scripts/haskell/hydra-report.hs: change Build.buildstatus to Maybe Int
The buildstatus may be `null` from Hydra if the Build hasn't finished running yet.
This commit is contained in:
parent
df0572cf3a
commit
461c374bda
1 changed files with 9 additions and 8 deletions
|
@ -92,7 +92,7 @@ data Eval = Eval
|
||||||
|
|
||||||
data Build = Build
|
data Build = Build
|
||||||
{ job :: Text
|
{ job :: Text
|
||||||
, buildstatus :: Int
|
, buildstatus :: Maybe Int
|
||||||
, finished :: Int
|
, finished :: Int
|
||||||
, id :: Int
|
, id :: Int
|
||||||
, nixname :: Text
|
, nixname :: Text
|
||||||
|
@ -155,7 +155,7 @@ getMaintainerMap = do
|
||||||
get c p i e = readProcess c p i <&> \x -> either (error . (<> "Raw:'" <> x <> "'") . (e <>)) Prelude.id . eitherDecodeStrict' . encodeUtf8 . Text.pack $ x
|
get c p i e = readProcess c p i <&> \x -> either (error . (<> "Raw:'" <> x <> "'") . (e <>)) Prelude.id . eitherDecodeStrict' . encodeUtf8 . Text.pack $ x
|
||||||
|
|
||||||
-- BuildStates are sorted by subjective importance/concerningness
|
-- BuildStates are sorted by subjective importance/concerningness
|
||||||
data BuildState = Failed | DependencyFailed | OutputLimitExceeded | Unknown Int | Aborted | Unfinished | Success deriving (Show, Eq, Ord)
|
data BuildState = Failed | DependencyFailed | OutputLimitExceeded | Unknown (Maybe Int) | Aborted | Unfinished | Success deriving (Show, Eq, Ord)
|
||||||
|
|
||||||
icon :: BuildState -> Text
|
icon :: BuildState -> Text
|
||||||
icon = \case
|
icon = \case
|
||||||
|
@ -194,13 +194,14 @@ buildSummary maintainerMap = foldl (Map.unionWith unionSummary) Map.empty . fmap
|
||||||
unionSummary (Table l, l') (Table r, r') = (Table $ Map.union l r, l' <> r')
|
unionSummary (Table l, l') (Table r, r') = (Table $ Map.union l r, l' <> r')
|
||||||
toSummary Build{finished, buildstatus, job, id, system} = Map.singleton name (Table (Map.singleton (set, Platform system) (BuildResult state id)), maintainers)
|
toSummary Build{finished, buildstatus, job, id, system} = Map.singleton name (Table (Map.singleton (set, Platform system) (BuildResult state id)), maintainers)
|
||||||
where
|
where
|
||||||
|
state :: BuildState
|
||||||
state = case (finished, buildstatus) of
|
state = case (finished, buildstatus) of
|
||||||
(0, _) -> Unfinished
|
(0, _) -> Unfinished
|
||||||
(_, 0) -> Success
|
(_, Just 0) -> Success
|
||||||
(_, 7) -> Aborted
|
(_, Just 7) -> Aborted
|
||||||
(_, 2) -> DependencyFailed
|
(_, Just 2) -> DependencyFailed
|
||||||
(_, 1) -> Failed
|
(_, Just 1) -> Failed
|
||||||
(_, 11) -> OutputLimitExceeded
|
(_, Just 11) -> OutputLimitExceeded
|
||||||
(_, i) -> Unknown i
|
(_, i) -> Unknown i
|
||||||
packageName = fromMaybe job (Text.stripSuffix ("." <> system) job)
|
packageName = fromMaybe job (Text.stripSuffix ("." <> system) job)
|
||||||
splitted = nonEmpty $ Text.splitOn "." packageName
|
splitted = nonEmpty $ Text.splitOn "." packageName
|
||||||
|
@ -309,5 +310,5 @@ printMarkBrokenList = do
|
||||||
(_, _, buildReport) <- readBuildReports
|
(_, _, buildReport) <- readBuildReports
|
||||||
forM_ buildReport \Build{buildstatus, job} ->
|
forM_ buildReport \Build{buildstatus, job} ->
|
||||||
case (buildstatus, Text.splitOn "." job) of
|
case (buildstatus, Text.splitOn "." job) of
|
||||||
(1, ["haskellPackages", name, "x86_64-linux"]) -> putStrLn $ " - " <> Text.unpack name
|
(Just 1, ["haskellPackages", name, "x86_64-linux"]) -> putStrLn $ " - " <> Text.unpack name
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
Loading…
Reference in a new issue