hpack 0.39.3 → 0.39.6
raw patch · 9 files changed
Files
- CHANGELOG.md +11/−0
- LICENSE +1/−1
- hpack.cabal +2/−5
- resources/test/hpack.cabal +2/−5
- src/Hpack/Config.hs +12/−3
- src/Hpack/Syntax/Dependencies.hs +11/−6
- src/Hpack/Syntax/DependencyVersion.hs +4/−0
- test/EndToEndSpec.hs +12/−0
- test/Hpack/Syntax/DependenciesSpec.hs +3/−0
CHANGELOG.md view
@@ -1,3 +1,14 @@+## Changes in 0.39.6+ - Add support for top-level field `codeberg`++## Changes in 0.39.5+ - When rendering build dependencies in a Cabal file, Hpack no longer excludes+ the reference to the main library from the shorthand syntax such as+ `my-package:{my-package,my-library1,mylibrary2}`.++## Changes in 0.39.4+ - Remove upper on `crypton`+ ## Changes in 0.39.3 - Add upper bound `crypton < 1.1`, as dependency `http-client-tls <= 0.3.6.4` does not support `crypton-1.1.0` but does not itself have an upper bound.
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014-2025 Simon Hengel <sol@typeful.net>+Copyright (c) 2014-2026 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hpack.cabal view
@@ -5,9 +5,9 @@ -- see: https://github.com/sol/hpack name: hpack-version: 0.39.3+version: 0.39.6 synopsis: A modern format for Haskell packages-description: See README at <https://github.com/sol/hpack#readme>+description: See the README at <https://github.com/sol/hpack#readme> category: Development homepage: https://github.com/sol/hpack#readme bug-reports: https://github.com/sol/hpack/issues@@ -72,7 +72,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath@@ -107,7 +106,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath@@ -206,7 +204,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath
resources/test/hpack.cabal view
@@ -5,9 +5,9 @@ -- see: https://github.com/sol/hpack name: hpack-version: 0.39.3+version: 0.39.6 synopsis: A modern format for Haskell packages-description: See README at <https://github.com/sol/hpack#readme>+description: See the README at <https://github.com/sol/hpack#readme> category: Development homepage: https://github.com/sol/hpack#readme bug-reports: https://github.com/sol/hpack/issues@@ -72,7 +72,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath@@ -107,7 +106,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath@@ -206,7 +204,6 @@ , bytestring , containers , cryptohash-sha256- , crypton <1.1 , deepseq , directory >=1.2.5.0 , filepath
src/Hpack/Config.hs view
@@ -610,6 +610,7 @@ , packageConfigDataFiles :: Maybe (List FilePath) , packageConfigDataDir :: Maybe FilePath , packageConfigGithub :: Maybe GitHub+, packageConfigCodeberg :: Maybe GitHub , packageConfigGit :: Maybe String , packageConfigCustomSetup :: Maybe CustomSetupSection , packageConfigLibrary :: Maybe library@@ -1380,7 +1381,7 @@ f name = "Specified source-dir " ++ show name ++ " does not exist" sourceRepository :: Maybe SourceRepository- sourceRepository = github <|> (`SourceRepository` Nothing) <$> packageConfigGit+ sourceRepository = codeberg <|> github <|> (`SourceRepository` Nothing) <$> packageConfigGit github :: Maybe SourceRepository github = toSourceRepository <$> packageConfigGithub@@ -1388,18 +1389,26 @@ toSourceRepository :: GitHub -> SourceRepository toSourceRepository (GitHub owner repo subdir) = SourceRepository (githubBaseUrl ++ owner ++ "/" ++ repo) subdir + codeberg :: Maybe SourceRepository+ codeberg = toSourceRepository <$> packageConfigCodeberg+ where+ toSourceRepository :: GitHub -> SourceRepository+ toSourceRepository (GitHub owner repo subdir) = SourceRepository (codebergBaseUrl ++ owner ++ "/" ++ repo) subdir+ homepage :: Maybe String homepage = case packageConfigHomepage of Just Nothing -> Nothing- _ -> join packageConfigHomepage <|> fromGithub+ _ -> join packageConfigHomepage <|> fromCodeberg <|> fromGithub where+ fromCodeberg = (++ "#readme") . sourceRepositoryUrl <$> codeberg fromGithub = (++ "#readme") . sourceRepositoryUrl <$> github bugReports :: Maybe String bugReports = case packageConfigBugReports of Just Nothing -> Nothing- _ -> join packageConfigBugReports <|> fromGithub+ _ -> join packageConfigBugReports <|> fromCodeberg <|> fromGithub where+ fromCodeberg = (++ "/issues") . sourceRepositoryUrl <$> codeberg fromGithub = (++ "/issues") . sourceRepositoryUrl <$> github maintainer :: Maybe (List String)
src/Hpack/Syntax/Dependencies.hs view
@@ -73,10 +73,15 @@ parseDependency subject = fmap fromCabal . cabalParse subject . T.unpack where fromCabal :: D.Dependency -> (String, DependencyVersion)- fromCabal d = (toName (D.depPkgName d) (DependencySet.toList $ D.depLibraries d), DependencyVersion Nothing . versionConstraintFromCabal $ D.depVerRange d)+ fromCabal (D.Dependency pkgName verRange libraries) =+ (depName, DependencyVersion Nothing $ versionConstraintFromCabal verRange)+ where+ depName :: String+ depName = prettyShow pkgName <> case DependencySet.toList libraries of+ [D.LMainLibName] -> ""+ [D.LSubLibName name] -> ":" <> prettyShow name+ xs -> ":{" <> intercalate "," (map renderComponent xs) <> "}" - toName :: D.PackageName -> [D.LibraryName] -> String- toName package components = prettyShow package <> case components of- [D.LMainLibName] -> ""- [D.LSubLibName lib] -> ":" <> prettyShow lib- xs -> ":{" <> (intercalate "," $ map prettyShow [name | D.LSubLibName name <- xs]) <> "}"+ renderComponent :: D.LibraryName -> String+ renderComponent D.LMainLibName = prettyShow pkgName+ renderComponent (D.LSubLibName name) = prettyShow name
src/Hpack/Syntax/DependencyVersion.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE ViewPatterns #-} module Hpack.Syntax.DependencyVersion ( githubBaseUrl+, codebergBaseUrl , GitRef , GitUrl @@ -44,6 +45,9 @@ githubBaseUrl :: String githubBaseUrl = "https://github.com/"++codebergBaseUrl :: String+codebergBaseUrl = "https://codeberg.org/" type GitUrl = String type GitRef = String
test/EndToEndSpec.hs view
@@ -314,6 +314,18 @@ github: https://github.com/sol/hpack/issues/365 |] `shouldFailWith` "package.yaml: Error while parsing $.github - expected owner/repo or owner/repo/subdir, but encountered \"https://github.com/sol/hpack/issues/365\"" + describe "codeberg" $ do+ it "accepts owner/repo" $ do+ [i|+ codeberg: sol/hpack+ |] `shouldRenderTo` package [i|+ homepage: https://codeberg.org/sol/hpack#readme+ bug-reports: https://codeberg.org/sol/hpack/issues+ source-repository head+ type: git+ location: https://codeberg.org/sol/hpack+ |]+ describe "homepage" $ do it "accepts homepage URL" $ do [i|
test/Hpack/Syntax/DependenciesSpec.hs view
@@ -29,6 +29,9 @@ it "accepts dependencies with multiple subcomponents" $ do parseDependency "dependency" "foo:{bar,baz}" `shouldReturn` ("foo:{bar,baz}", DependencyVersion Nothing AnyVersion) + it "accepts dependencies with multiple subcomponents including the main library" $ do+ parseDependency "dependency" "foo:{foo,bar,baz}" `shouldReturn` ("foo:{foo,bar,baz}", DependencyVersion Nothing AnyVersion)+ describe "fromValue" $ do context "when parsing Dependencies" $ do context "with a scalar" $ do