-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122719 from NixOS/haskell-updates
haskell: update package set
- Loading branch information
Showing
15 changed files
with
934 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3591,6 +3591,12 @@ | |
githubId = 606000; | ||
name = "Gabriel Adomnicai"; | ||
}; | ||
Gabriel439 = { | ||
email = "[email protected]"; | ||
github = "Gabriel439"; | ||
githubId = 1313787; | ||
name = "Gabriel Gonzalez"; | ||
}; | ||
gal_bolle = { | ||
email = "[email protected]"; | ||
github = "FlorentBecker"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ Because step 1) is quite expensive and takes roughly ~5 minutes the result is ca | |
{-# LANGUAGE BlockArguments #-} | ||
{-# LANGUAGE DeriveAnyClass #-} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE DerivingStrategies #-} | ||
{-# LANGUAGE DuplicateRecordFields #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE MultiWayIf #-} | ||
|
@@ -36,8 +37,6 @@ import Data.Aeson ( | |
encodeFile, | ||
) | ||
import Data.Foldable (Foldable (toList), foldl') | ||
import Data.Function ((&)) | ||
import Data.Functor ((<&>)) | ||
import Data.List.NonEmpty (NonEmpty, nonEmpty) | ||
import qualified Data.List.NonEmpty as NonEmpty | ||
import Data.Map.Strict (Map) | ||
|
@@ -71,7 +70,6 @@ import System.Directory (XdgDirectory (XdgCache), getXdgDirectory) | |
import System.Environment (getArgs) | ||
import System.Process (readProcess) | ||
import Prelude hiding (id) | ||
import qualified Prelude | ||
|
||
newtype JobsetEvals = JobsetEvals | ||
{ evals :: Seq Eval | ||
|
@@ -132,30 +130,117 @@ getBuildReports = runReq defaultHttpConfig do | |
|
||
hydraEvalCommand :: FilePath | ||
hydraEvalCommand = "hydra-eval-jobs" | ||
|
||
hydraEvalParams :: [String] | ||
hydraEvalParams = ["-I", ".", "pkgs/top-level/release-haskell.nix"] | ||
|
||
handlesCommand :: FilePath | ||
handlesCommand = "nix-instantiate" | ||
|
||
handlesParams :: [String] | ||
handlesParams = ["--eval", "--strict", "--json", "-"] | ||
|
||
handlesExpression :: String | ||
handlesExpression = "with import ./. {}; with lib; zipAttrsWith (_: builtins.head) (mapAttrsToList (_: v: if v ? github then { \"${v.email}\" = v.github; } else {}) (import maintainers/maintainer-list.nix))" | ||
|
||
newtype Maintainers = Maintainers {maintainers :: Maybe Text} deriving (Generic, ToJSON, FromJSON) | ||
|
||
-- | This newtype is used to parse a Hydra job output from @hydra-eval-jobs@. | ||
-- The only field we are interested in is @maintainers@, which is why this | ||
-- is just a newtype. | ||
-- | ||
-- Note that there are occassionally jobs that don't have a maintainers | ||
-- field, which is why this has to be @Maybe Text@. | ||
newtype Maintainers = Maintainers { maintainers :: Maybe Text } | ||
deriving stock (Generic, Show) | ||
deriving anyclass (FromJSON, ToJSON) | ||
|
||
-- | This is a 'Map' from Hydra job name to maintainer email addresses. | ||
-- | ||
-- It has values similar to the following: | ||
-- | ||
-- @@ | ||
-- fromList | ||
-- [ ("arion.aarch64-linux", Maintainers (Just "[email protected]")) | ||
-- , ("bench.x86_64-linux", Maintainers (Just "")) | ||
-- , ("conduit.x86_64-linux", Maintainers (Just "[email protected], [email protected]")) | ||
-- , ("lens.x86_64-darwin", Maintainers (Just "[email protected]")) | ||
-- ] | ||
-- @@ | ||
-- | ||
-- Note that Hydra jobs without maintainers will have an empty string for the | ||
-- maintainer list. | ||
type HydraJobs = Map Text Maintainers | ||
|
||
-- | Map of email addresses to GitHub handles. | ||
-- This is built from the file @../../maintainer-list.nix@. | ||
-- | ||
-- It has values similar to the following: | ||
-- | ||
-- @@ | ||
-- fromList | ||
-- [ ("[email protected]", "rob22") | ||
-- , ("[email protected]", "edkm") | ||
-- ] | ||
-- @@ | ||
type EmailToGitHubHandles = Map Text Text | ||
|
||
-- | Map of Hydra jobs to maintainer GitHub handles. | ||
-- | ||
-- It has values similar to the following: | ||
-- | ||
-- @@ | ||
-- fromList | ||
-- [ ("arion.aarch64-linux", ["rob22"]) | ||
-- , ("conduit.x86_64-darwin", ["snoyb", "webber"]) | ||
-- ] | ||
-- @@ | ||
type MaintainerMap = Map Text (NonEmpty Text) | ||
|
||
-- | Generate a mapping of Hydra job names to maintainer GitHub handles. | ||
getMaintainerMap :: IO MaintainerMap | ||
getMaintainerMap = do | ||
hydraJobs :: HydraJobs <- get hydraEvalCommand hydraEvalParams "" "Failed to decode hydra-eval-jobs output: " | ||
handlesMap :: Map Text Text <- get handlesCommand handlesParams handlesExpression "Failed to decode nix output for lookup of github handles: " | ||
pure $ hydraJobs & Map.mapMaybe (nonEmpty . mapMaybe (`Map.lookup` handlesMap) . Text.splitOn ", " . fromMaybe "" . maintainers) | ||
where | ||
get c p i e = readProcess c p i <&> \x -> either (error . (<> " Raw:'" <> take 1000 x <> "'") . (e <>)) Prelude.id . eitherDecodeStrict' . encodeUtf8 . Text.pack $ x | ||
hydraJobs :: HydraJobs <- | ||
readJSONProcess hydraEvalCommand hydraEvalParams "" "Failed to decode hydra-eval-jobs output: " | ||
handlesMap :: EmailToGitHubHandles <- | ||
readJSONProcess handlesCommand handlesParams handlesExpression "Failed to decode nix output for lookup of github handles: " | ||
pure $ Map.mapMaybe (splitMaintainersToGitHubHandles handlesMap) hydraJobs | ||
where | ||
-- Split a comma-spearated string of Maintainers into a NonEmpty list of | ||
-- GitHub handles. | ||
splitMaintainersToGitHubHandles | ||
:: EmailToGitHubHandles -> Maintainers -> Maybe (NonEmpty Text) | ||
splitMaintainersToGitHubHandles handlesMap (Maintainers maint) = | ||
nonEmpty . mapMaybe (`Map.lookup` handlesMap) . Text.splitOn ", " $ fromMaybe "" maint | ||
|
||
-- | Run a process that produces JSON on stdout and and decode the JSON to a | ||
-- data type. | ||
-- | ||
-- If the JSON-decoding fails, throw the JSON-decoding error. | ||
readJSONProcess | ||
:: FromJSON a | ||
=> FilePath -- ^ Filename of executable. | ||
-> [String] -- ^ Arguments | ||
-> String -- ^ stdin to pass to the process | ||
-> String -- ^ String to prefix to JSON-decode error. | ||
-> IO a | ||
readJSONProcess exe args input err = do | ||
output <- readProcess exe args input | ||
let eitherDecodedOutput = eitherDecodeStrict' . encodeUtf8 . Text.pack $ output | ||
case eitherDecodedOutput of | ||
Left decodeErr -> error $ err <> decodeErr <> "\nRaw: '" <> take 1000 output <> "'" | ||
Right decodedOutput -> pure decodedOutput | ||
|
||
-- BuildStates are sorted by subjective importance/concerningness | ||
data BuildState = Failed | DependencyFailed | OutputLimitExceeded | Unknown (Maybe Int) | TimedOut | Canceled | HydraFailure | Unfinished | Success deriving (Show, Eq, Ord) | ||
data BuildState | ||
= Failed | ||
| DependencyFailed | ||
| OutputLimitExceeded | ||
| Unknown (Maybe Int) | ||
| TimedOut | ||
| Canceled | ||
| HydraFailure | ||
| Unfinished | ||
| Success | ||
deriving stock (Show, Eq, Ord) | ||
|
||
icon :: BuildState -> Text | ||
icon = \case | ||
|
@@ -243,7 +328,7 @@ printJob evalId name (Table mapping, maintainers) = | |
printSingleRow set = "- [ ] " <> printState set <> " " <> makeJobSearchLink set (makePkgName set) <> " " <> maintainers | ||
makePkgName set = (if Text.null set then "" else set <> ".") <> name | ||
printState set = Text.intercalate " " $ map (\pf -> maybe "" (label pf) $ Map.lookup (set, pf) mapping) platforms | ||
makeJobSearchLink set linkLabel= makeSearchLink evalId linkLabel (makePkgName set <> ".") -- Append '.' to the search query to prevent e.g. "hspec." matching "hspec-golden.x86_64-linux" | ||
makeJobSearchLink set linkLabel= makeSearchLink evalId linkLabel (makePkgName set) | ||
sets = toList $ Set.fromList (fst <$> Map.keys mapping) | ||
platforms = toList $ Set.fromList (snd <$> Map.keys mapping) | ||
label pf (BuildResult s i) = "[[" <> platformIcon pf <> icon s <> "]](https://hydra.nixos.org/build/" <> showT i <> ")" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"commit": "b963dde27c24394c4be0031039dae4cb6a363aed", | ||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/b963dde27c24394c4be0031039dae4cb6a363aed.tar.gz", | ||
"sha256": "1yr9j4ldpi2p2zgdq4mky6y5yh7nilasdmskapbdxp9fxwba2r0x", | ||
"msg": "Update from Hackage at 2021-05-10T22:01:59Z" | ||
"commit": "2295bd36e0d36af6e862dfdb7b0694fba2e7cb58", | ||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/2295bd36e0d36af6e862dfdb7b0694fba2e7cb58.tar.gz", | ||
"sha256": "1bzqy6kbw0i1ryg3ia5spg6m62zkc46xhhn0h76pfq7mfmm3fqf8", | ||
"msg": "Update from Hackage at 2021-05-12T11:46:04Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.