summary refs log tree commit diff
path: root/maintainers/scripts/haskell/hydra-report.hs
diff options
context:
space:
mode:
author(cdep)illabout <cdep.illabout@gmail.com>2021-05-08 14:13:20 +0900
committerMalte Brandy <malte.brandy@maralorn.de>2021-05-10 22:36:43 +0200
commit461c374bda601ae6666f8ac693d328579112b79f (patch)
treea0f5ffc51e9fb3e8a71454368d3a2a2e78fe8917 /maintainers/scripts/haskell/hydra-report.hs
parentdf0572cf3a34a73a66f2437c6737ceed2f26b3a3 (diff)
downloadnixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar.gz
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar.bz2
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar.lz
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar.xz
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.tar.zst
nixpkgs-461c374bda601ae6666f8ac693d328579112b79f.zip
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.
Diffstat (limited to 'maintainers/scripts/haskell/hydra-report.hs')
-rwxr-xr-xmaintainers/scripts/haskell/hydra-report.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/maintainers/scripts/haskell/hydra-report.hs b/maintainers/scripts/haskell/hydra-report.hs
index 9e1641ce8f8..6449e1bbab9 100755
--- a/maintainers/scripts/haskell/hydra-report.hs
+++ b/maintainers/scripts/haskell/hydra-report.hs
@@ -92,7 +92,7 @@ data Eval = Eval
 
 data Build = Build
    { job :: Text
-   , buildstatus :: Int
+   , buildstatus :: Maybe Int
    , finished :: Int
    , id :: Int
    , 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
 
 -- 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 = \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')
    toSummary Build{finished, buildstatus, job, id, system} = Map.singleton name (Table (Map.singleton (set, Platform system) (BuildResult state id)), maintainers)
      where
+      state :: BuildState
       state = case (finished, buildstatus) of
          (0, _) -> Unfinished
-         (_, 0) -> Success
-         (_, 7) -> Aborted
-         (_, 2) -> DependencyFailed
-         (_, 1) -> Failed
-         (_, 11) -> OutputLimitExceeded
+         (_, Just 0) -> Success
+         (_, Just 7) -> Aborted
+         (_, Just 2) -> DependencyFailed
+         (_, Just 1) -> Failed
+         (_, Just 11) -> OutputLimitExceeded
          (_, i) -> Unknown i
       packageName = fromMaybe job (Text.stripSuffix ("." <> system) job)
       splitted = nonEmpty $ Text.splitOn "." packageName
@@ -309,5 +310,5 @@ printMarkBrokenList = do
    (_, _, buildReport) <- readBuildReports
    forM_ buildReport \Build{buildstatus, job} ->
       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 ()