From a8fa46a964af409c0bad72dd87d9777d07ca22b1 Mon Sep 17 00:00:00 2001 From: maralorn Date: Tue, 10 Jan 2023 00:34:51 +0100 Subject: [PATCH] maintainers/../haskell/mark-broken: Insert eval info in commit msg --- maintainers/scripts/haskell/hydra-report.hs | 45 ++++++++++++--------- maintainers/scripts/haskell/mark-broken.sh | 5 ++- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/maintainers/scripts/haskell/hydra-report.hs b/maintainers/scripts/haskell/hydra-report.hs index f5e8da1b3f4d..f86f0fbc6a2d 100755 --- a/maintainers/scripts/haskell/hydra-report.hs +++ b/maintainers/scripts/haskell/hydra-report.hs @@ -112,7 +112,8 @@ main = do ["get-report"] -> getBuildReports ["ping-maintainers"] -> printMaintainerPing ["mark-broken-list"] -> printMarkBrokenList - _ -> putStrLn "Usage: get-report | ping-maintainers | mark-broken-list" + ["eval-info"] -> printEvalInfo + _ -> putStrLn "Usage: get-report | ping-maintainers | mark-broken-list | eval-info" reportFileName :: IO FilePath reportFileName = getXdgDirectory XdgCache "haskell-updates-build-report.json" @@ -396,12 +397,22 @@ jobTotals (summaryBuilds -> Table mapping) = getSum <$> Table (Map.foldMapWithKe details :: Text -> [Text] -> [Text] details summary content = ["
" <> summary <> " ", ""] <> content <> ["
", ""] +evalLine :: Eval -> UTCTime -> Text +evalLine Eval{id, jobsetevalinputs = JobsetEvalInputs{nixpkgs = Nixpkgs{revision}}} fetchTime = + "*evaluation [" + <> showT id + <> "](https://hydra.nixos.org/eval/" + <> showT id + <> ") of nixpkgs commit [" + <> Text.take 7 revision + <> "](https://github.com/NixOS/nixpkgs/commits/" + <> revision + <> ") as of " + <> Text.pack (formatTime defaultTimeLocale "%Y-%m-%d %H:%M UTC" fetchTime) + <> "*" + printBuildSummary :: Eval -> UTCTime -> StatusSummary -> [(Text, Int)] -> Text -printBuildSummary - Eval{id, jobsetevalinputs = JobsetEvalInputs{nixpkgs = Nixpkgs{revision}}} - fetchTime - summary - topBrokenRdeps = +printBuildSummary eval@Eval{id} fetchTime summary topBrokenRdeps = Text.unlines $ headline <> [""] <> tldr <> ((" * "<>) <$> (errors <> warnings)) <> [""] <> totals @@ -416,25 +427,14 @@ printBuildSummary <> footer where footer = ["*Report generated with [maintainers/scripts/haskell/hydra-report.hs](https://github.com/NixOS/nixpkgs/blob/haskell-updates/maintainers/scripts/haskell/hydra-report.hs)*"] + headline = + [ "### [haskell-updates build report from hydra](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates)" + , evalLine eval fetchTime ] totals = [ "#### Build summary" , "" ] <> printTable "Platform" (\x -> makeSearchLink id (platform x <> " " <> platformIcon x) ("." <> platform x)) (\x -> showT x <> " " <> icon x) showT numSummary - headline = - [ "### [haskell-updates build report from hydra](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates)" - , "*evaluation [" - <> showT id - <> "](https://hydra.nixos.org/eval/" - <> showT id - <> ") of nixpkgs commit [" - <> Text.take 7 revision - <> "](https://github.com/NixOS/nixpkgs/commits/" - <> revision - <> ") as of " - <> Text.pack (formatTime defaultTimeLocale "%Y-%m-%d %H:%M UTC" fetchTime) - <> "*" - ] brokenLine (name, rdeps) = "[" <> name <> "](https://packdeps.haskellers.com/reverse/" <> name <> ") :arrow_heading_up: " <> Text.pack (show rdeps) <> " " numSummary = statusToNumSummary summary jobsByState predicate = Map.filter (predicate . worstState) summary @@ -469,6 +469,11 @@ printBuildSummary maintainedJob = Map.lookup "maintained" summary mergeableJob = Map.lookup "mergeable" summary +printEvalInfo :: IO () +printEvalInfo = do + (eval, fetchTime, _) <- readBuildReports + putStrLn (Text.unpack $ evalLine eval fetchTime) + printMaintainerPing :: IO () printMaintainerPing = do (maintainerMap, (reverseDependencyMap, topBrokenRdeps)) <- concurrently getMaintainerMap do diff --git a/maintainers/scripts/haskell/mark-broken.sh b/maintainers/scripts/haskell/mark-broken.sh index 97dd5be8aaa6..2111ef52bc05 100755 --- a/maintainers/scripts/haskell/mark-broken.sh +++ b/maintainers/scripts/haskell/mark-broken.sh @@ -34,6 +34,7 @@ clear="env -u HOME -u NIXPKGS_CONFIG" $clear maintainers/scripts/haskell/regenerate-hackage-packages.sh $clear maintainers/scripts/haskell/regenerate-transitive-broken-packages.sh $clear maintainers/scripts/haskell/regenerate-hackage-packages.sh +evalline=$(maintainers/scripts/haskell/hydra-report.hs eval-info) if [[ "${1:-}" == "--do-commit" ]]; then git add $broken_config @@ -42,6 +43,8 @@ git add pkgs/development/haskell-modules/hackage-packages.nix git commit -F - << EOF haskellPackages: mark builds failing on hydra as broken -This commit has been generated by maintainers/scripts/haskell/mark-broken.sh +This commit has been generated by maintainers/scripts/haskell/mark-broken.sh based on +$evalline +from the haskell-updates jobset on hydra under https://hydra.nixos.org/jobset/nixpkgs/haskell-updates EOF fi