-
-
Notifications
You must be signed in to change notification settings - Fork 159
hackage2nix: add excluded-packages config option #667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| indent_size = 2 | ||
| indent_style = space | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,11 @@ data Configuration = Configuration | |
| -- also disable their meta.hydraPlatforms attribute to avoid cluttering our | ||
| -- Hydra job with lots of failure messages. | ||
| , brokenPackages :: [Constraint] | ||
|
|
||
| -- |These packages have likely been broken for a long time and are unmaintained | ||
sternenseemann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -- upstream. To reduce the size of hackage-packages.nix, we don't even create | ||
| -- expressions for them. | ||
| , excludedPackages :: Set PackageName | ||
| } | ||
| deriving (Show, Generic) | ||
|
|
||
|
|
@@ -79,6 +84,7 @@ instance Semigroup Configuration where | |
| , unsupportedPlatforms = unsupportedPlatforms l <> unsupportedPlatforms r | ||
| , dontDistributePackages = dontDistributePackages l <> dontDistributePackages r | ||
| , brokenPackages = brokenPackages l <> brokenPackages r | ||
| , excludedPackages = excludedPackages l <> excludedPackages r | ||
| } | ||
|
|
||
| instance FromJSON Configuration where | ||
|
|
@@ -92,6 +98,7 @@ instance FromJSON Configuration where | |
| <*> o .:? "unsupported-platforms" .!= mempty | ||
| <*> o .:? "dont-distribute-packages" .!= mempty | ||
| <*> o .:? "broken-packages" .!= mempty | ||
| <*> o .:? "excluded-packages" .!= mempty | ||
| parseJSON _ = error "invalid Configuration" | ||
|
|
||
| instance FromJSON Identifier where | ||
|
|
@@ -114,7 +121,11 @@ assertConsistency :: MonadFail m => Configuration -> m Configuration | |
| assertConsistency cfg@Configuration {..} = do | ||
| let report msg = fail ("*** configuration error: " ++ msg) | ||
| maintainedPackages = Set.unions (Map.elems packageMaintainers) | ||
| disabledPackages = dontDistributePackages `Set.union` Set.fromList (constraintPkgName <$> brokenPackages) | ||
| disabledPackages = Set.unions | ||
| [ dontDistributePackages | ||
| , Set.fromList (constraintPkgName <$> brokenPackages) | ||
| , excludedPackages | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you note why they have to be added to disabled here? This may not be clear since they are removed anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the idea was that if there is a maintained package that will be removed (excluded) that way, this would throw an error - which I think is a good thing to look into that case in more detail. I didn't test this, though. Is that roughly what this function does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I believe so. |
||
| ] | ||
| disabledMaintainedPackages = maintainedPackages `Set.intersection` disabledPackages | ||
| unless (Set.null disabledMaintainedPackages) $ | ||
| report ("disabled packages that have a maintainer: " ++ show disabledMaintainedPackages) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.