git.iko.soy/typeable/cabal2nix
on master help sign in
hackage2nix: the 'broken-packages' section now contains versioned package names
commite08962a427a7dd23f18cb84d4cbde1e92b87c3b6 authorPeter Simons <simons@cryp.to> dateMon 15 Apr 2019, 19:02 (8 years ago) parentc57cbfc
3 files changed+9−7
hackage2nix/Main.hs+1−1 src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+4−6 src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs+4
hackage2nix/Main.hs+1−1
@@ -135,7 +135,7 @@ main = do
135135 let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool
136136 isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)
137137 isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)
138− isBroken = name `Set.member` brokenPackages config
138+ isBroken = any (withinRange v) [ vr | Dependency pn vr <- brokenPackages config, pn == name ]
139139
140140 droppedPlatforms :: Set Platform
141141 droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+4−6
@@ -9,8 +9,8 @@ module Distribution.Nixpkgs.Haskell.FromCabal.Configuration
99 )
1010 where
1111
12−import Control.Exception ( throwIO )
1312import Control.DeepSeq
13+import Control.Exception ( throwIO )
1414import Control.Lens
1515import Control.Monad
1616import Data.Aeson
@@ -57,7 +57,7 @@ data Configuration = Configuration
5757 -- |We know that these packages won't compile, so we mark them as broken and
5858 -- also disable their meta.hydraPlatforms attribute to avoid cluttering our
5959 -- Hydra job with lots of failure messages.
60− , brokenPackages :: Set PackageName
60+ , brokenPackages :: [Constraint]
6161 }
6262 deriving (Show, Generic)
6363
@@ -89,15 +89,13 @@ parseKey :: FromJSON k => Text -> k
8989parseKey s = either error id (parseEither parseJSON (String s))
9090
9191readConfiguration :: FilePath -> IO Configuration
92−readConfiguration path =
93− decodeFileEither path >>= either throwIO assertConsistency
92+readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency
9493
9594assertConsistency :: Monad m => Configuration -> m Configuration
9695assertConsistency cfg@Configuration {..} = do
9796 let report msg = fail ("*** configuration error: " ++ msg)
98−
9997 maintainedPackages = Set.unions (Map.elems packageMaintainers)
100− disabledPackages = dontDistributePackages `Set.union` brokenPackages
98+ disabledPackages = dontDistributePackages `Set.union` Set.fromList (depPkgName <$> brokenPackages)
10199 disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages
102100 unless (Set.null disabledMaintainedPackages) $
103101 report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages)
src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs+4
@@ -49,6 +49,10 @@ instance FromJSON PackageIdentifier where
4949 parseJSON (String s) = return (fromString (T.unpack s))
5050 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell package identifier")
5151
52+instance FromJSON VersionRange where
53+ parseJSON (String s) = return (fromString (T.unpack s))
54+ parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Cabal VersionRange")
55+
5256instance FromJSON Dependency where
5357 parseJSON (String s) = return (fromString (T.unpack s))
5458 parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell Dependency")