mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-12 15:28:29 +01:00
Provide replacement Github names #226
This commit is contained in:
parent
684bf6d452
commit
ceac2c4a98
@ -3,7 +3,9 @@ module Stackage.Config where
|
||||
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.Trans.Writer (execWriter, tell)
|
||||
import Data.Char (toLower)
|
||||
import qualified Data.Map as Map
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Set (fromList, singleton)
|
||||
import Distribution.Text (simpleParse)
|
||||
import Stackage.Types
|
||||
@ -452,3 +454,19 @@ defaultStablePackages ghcVer requireHP = unPackageMap $ execWriter $ do
|
||||
case simpleParse range of
|
||||
Nothing -> error $ "Invalid range " ++ show range ++ " for " ++ package
|
||||
Just range' -> tell $ PackageMap $ Map.singleton (PackageName package) (range', Maintainer maintainer)
|
||||
|
||||
-- | Replacement Github users. This is useful when a project is owned by an
|
||||
-- organization, and you'd like to ping either an individual or a team in that
|
||||
-- organization. See:
|
||||
--
|
||||
-- https://github.com/fpco/stackage/issues/226#issuecomment-45644142
|
||||
convertGithubUser :: String -> String
|
||||
convertGithubUser x =
|
||||
fromMaybe x $ Map.lookup (map toLower x) pairs
|
||||
where
|
||||
pairs = Map.fromList
|
||||
[ ("diagrams", "byorgey")
|
||||
, ("yesodweb", "snoyberg")
|
||||
, ("fpco", "snoyberg")
|
||||
, ("faylang", "bergmark")
|
||||
]
|
||||
|
||||
@ -43,6 +43,7 @@ import Distribution.Text (simpleParse)
|
||||
import Distribution.Version (Version (Version),
|
||||
unionVersionRanges,
|
||||
withinRange)
|
||||
import Stackage.Config (convertGithubUser)
|
||||
import Stackage.Types
|
||||
import Stackage.Util
|
||||
import System.Directory (doesFileExist, getDirectoryContents)
|
||||
@ -184,7 +185,7 @@ loadPackageDB settings coreMap core deps = do
|
||||
, Set.fromList $ map depName $ testBenchBuildInfo gpd
|
||||
, Just gpd
|
||||
, Set.fromList $ map (Executable . fst) $ condExecutables gpd
|
||||
, listToMaybe $ catMaybes
|
||||
, fmap convertGithubUser $ listToMaybe $ catMaybes
|
||||
$ parseGithubUserHP (homepage $ packageDescription gpd)
|
||||
: map parseGithubUserSR (sourceRepos $ packageDescription gpd)
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user