diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index 0c6ade9e65a4b3b021964397616313be7f4bc2cc..492a43fe10d73244a8db54321e4c8a238c0335ea 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: Cabal -version: 3.0.1.0 +version: 3.0.2.0 copyright: 2003-2019, Cabal Development Team (see AUTHORS file) license: BSD3 license-file: LICENSE diff --git a/Cabal/ChangeLog.md b/Cabal/ChangeLog.md index 0e3f947108648db9cd5da9960bcdc9a3b2409ede..b3e0f3d27fb6c472c977a59fc5c1ffff6bdbe56c 100644 --- a/Cabal/ChangeLog.md +++ b/Cabal/ChangeLog.md @@ -1,3 +1,7 @@ +# 3.0.2.0 + * Disallow spaces around colon `:` in Dependency (`build-depends` syntax + * Make `configure` accept any `pkg-config --modversion` output + # 3.0.1.0 TBW * Add GHC-8.8 flags to normaliseGhcFlags ([#6379](https://github.com/haskell/cabal/pull/6379)) diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs index 4039a078ff525637c90a1e5057219afa6b90e1f0..fb7dc3ad37d2a46e3d81a93d2f0a1c237c015a09 100644 --- a/Cabal/Distribution/Simple/Configure.hs +++ b/Cabal/Distribution/Simple/Configure.hs @@ -79,6 +79,7 @@ import Distribution.Simple.BuildTarget import Distribution.Simple.LocalBuildInfo import Distribution.Types.ExeDependency import Distribution.Types.LegacyExeDependency +import Distribution.Types.PkgconfigVersion import Distribution.Types.PkgconfigDependency import Distribution.Types.PkgconfigVersionRange import Distribution.Types.LocalBuildInfo @@ -118,7 +119,7 @@ import Data.ByteString.Lazy ( ByteString ) import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy.Char8 as BLC8 import Data.List - ( (\\), partition, inits, stripPrefix, intersect ) + ( (\\), partition, inits, stripPrefix, intersect, dropWhileEnd ) import Data.Either ( partitionEithers ) import qualified Data.Map as Map @@ -1612,13 +1613,11 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled version <- pkgconfig ["--modversion", pkg] `catchIO` (\_ -> die' verbosity notFound) `catchExit` (\_ -> die' verbosity notFound) - case simpleParsec version of - Nothing -> die' verbosity - "parsing output of pkg-config --modversion failed" - Just v | not (withinPkgconfigVersionRange v range) -> - die' verbosity (badVersion v) - | otherwise -> - info verbosity (depSatisfied v) + let trim = dropWhile isSpace . dropWhileEnd isSpace + let v = PkgconfigVersion (toUTF8BS $ trim version) + if not (withinPkgconfigVersionRange v range) + then die' verbosity (badVersion v) + else info verbosity (depSatisfied v) where notFound = "The pkg-config package '" ++ pkg ++ "'" ++ versionRequirement diff --git a/Cabal/Distribution/Types/Dependency.hs b/Cabal/Distribution/Types/Dependency.hs index 3ec5d9846b9c3564013fed0a4939c84bc7b30060..96de1474211b811f31b26ac5ada3b30b02daf1cb 100644 --- a/Cabal/Distribution/Types/Dependency.hs +++ b/Cabal/Distribution/Types/Dependency.hs @@ -57,9 +57,9 @@ instance NFData Dependency where rnf = genericRnf instance Pretty Dependency where pretty (Dependency name ver sublibs) = pretty name - <+> optionalMonoid - (sublibs /= Set.singleton LMainLibName) - (PP.colon <+> PP.braces prettySublibs) + <<>> optionalMonoid + (sublibs /= Set.singleton LMainLibName) + (PP.colon <<>> PP.braces prettySublibs) <+> pretty ver where optionalMonoid True x = x @@ -81,12 +81,40 @@ versionGuardMultilibs expr = do else expr +-- | +-- +-- >>> simpleParsec "mylib:sub" :: Maybe Dependency +-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub")])) +-- +-- >>> simpleParsec "mylib:{sub1,sub2}" :: Maybe Dependency +-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")])) +-- +-- >>> simpleParsec "mylib:{ sub1 , sub2 }" :: Maybe Dependency +-- Just (Dependency (PackageName "mylib") AnyVersion (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")])) +-- +-- >>> simpleParsec "mylib:{ sub1 , sub2 } ^>= 42" :: Maybe Dependency +-- Just (Dependency (PackageName "mylib") (MajorBoundVersion (mkVersion [42])) (fromList [LSubLibName (UnqualComponentName "sub1"),LSubLibName (UnqualComponentName "sub2")])) +-- +-- Spaces around colon are not allowed: +-- +-- >>> simpleParsec "mylib: sub" :: Maybe Dependency +-- Nothing +-- +-- >>> simpleParsec "mylib :sub" :: Maybe Dependency +-- Nothing +-- +-- >>> simpleParsec "mylib: {sub1,sub2}" :: Maybe Dependency +-- Nothing +-- +-- >>> simpleParsec "mylib :{sub1,sub2}" :: Maybe Dependency +-- Nothing +-- instance Parsec Dependency where parsec = do - name <- lexemeParsec + name <- parsec libs <- option [LMainLibName] - $ (char ':' *> spaces *>) + $ (char ':' *>) $ versionGuardMultilibs $ pure <$> parseLib name <|> parseMultipleLibs name diff --git a/Cabal/Distribution/Types/PkgconfigVersion.hs b/Cabal/Distribution/Types/PkgconfigVersion.hs index 81bb8c4e274d27ff9617168a4f853cfe4ea81ee5..3c62c6a869c81db2abf5234f6929f62270746b31 100644 --- a/Cabal/Distribution/Types/PkgconfigVersion.hs +++ b/Cabal/Distribution/Types/PkgconfigVersion.hs @@ -39,6 +39,14 @@ instance NFData PkgconfigVersion where rnf = genericRnf instance Pretty PkgconfigVersion where pretty (PkgconfigVersion bs) = PP.text (BS8.unpack bs) +-- | +-- +-- >>> simpleParsec "1.0.2n" :: Maybe PkgconfigVersion +-- Just (PkgconfigVersion "1.0.2n") +-- +-- >>> simpleParsec "0.3.5+ds" :: Maybe PkgconfigVersion +-- Nothing +-- instance Parsec PkgconfigVersion where parsec = PkgconfigVersion . BS8.pack <$> P.munch1 predicate where predicate c = isAsciiAlphaNum c || c == '.' || c == '-' diff --git a/Cabal/Makefile b/Cabal/Makefile index ae0c9e70129f1fa07fc1848295e56ab1b7b9b83f..52ce67c0a1feac468c4d984b9b360d6ab0231b95 100644 --- a/Cabal/Makefile +++ b/Cabal/Makefile @@ -1,4 +1,4 @@ -VERSION=3.0.1.0 +VERSION=3.0.2.0 #KIND=devel KIND=rc diff --git a/Cabal/doc/conf.py b/Cabal/doc/conf.py index de8f61f0c99beaf7e0812f5d071d572486118e94..877db27d1cdc51dee7443875a0f30dea7d258590 100644 --- a/Cabal/doc/conf.py +++ b/Cabal/doc/conf.py @@ -13,7 +13,7 @@ import sphinx_rtd_theme sys.path.insert(0, os.path.abspath('.')) import cabaldomain -version = "3.0.1.0" +version = "3.0.2.0" extensions = ['sphinx.ext.extlinks', 'sphinx.ext.todo'] diff --git a/Cabal/tests/ParserTests/regressions/issue-5846.format b/Cabal/tests/ParserTests/regressions/issue-5846.format index 7ddb6afaee1a27d3afa4292e1039af94b97de83e..bd742612afd95bd5995bdeee5e1c5fde7a5cf677 100644 --- a/Cabal/tests/ParserTests/regressions/issue-5846.format +++ b/Cabal/tests/ParserTests/regressions/issue-5846.format @@ -5,7 +5,7 @@ version: 5846 library default-language: Haskell2010 build-depends: - lib1 : {a, b} -any, - lib2 : {c} -any, - lib3 : {d} >=1, - lib4 : {a, b} >=1 + lib1:{a, b} -any, + lib2:{c} -any, + lib3:{d} >=1, + lib4:{a, b} >=1 diff --git a/cabal-install/bootstrap.sh b/cabal-install/bootstrap.sh index a96b95bab7626b5d6e8368e224528598f47f7e6c..090360cba76cbd1c0a9361f38f7ac42b5d4a2967 100755 --- a/cabal-install/bootstrap.sh +++ b/cabal-install/bootstrap.sh @@ -224,7 +224,7 @@ NETWORK_URI_VER="2.6.1.0"; NETWORK_URI_VER_REGEXP="2\.6\.(0\.[2-9]|[1-9])" # >= 2.6.0.2 && < 2.7 NETWORK_VER="2.7.0.0"; NETWORK_VER_REGEXP="2\.[0-7]\." # >= 2.0 && < 2.7 -CABAL_VER="3.0.1.0"; CABAL_VER_REGEXP="3\.0\.[1-9]" +CABAL_VER="3.0.2.0"; CABAL_VER_REGEXP="3\.0\.[1-9]" # >= 3.0.1 && < 3.1 TRANS_VER="0.5.5.0"; TRANS_VER_REGEXP="0\.[45]\." # >= 0.2.* && < 0.6 diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out index 7e51c00ef041efef4289af30248ad301673f3ada..78899c26837f3d2a98f98386fd19391183c33b24 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/cabal.out @@ -9,4 +9,4 @@ Preprocessing library 'privatelib' for d-0.1.0.0.. Building library 'privatelib' for d-0.1.0.0.. Configuring library for p-0.1.0.0.. cabal: Encountered missing or private dependencies: - d : {privatelib} ==0.1.0.0 + d:{privatelib} ==0.1.0.0 diff --git a/cabal-testsuite/cabal-testsuite.cabal b/cabal-testsuite/cabal-testsuite.cabal index def1c5a3b4c4e836524453640bb123a6d8d31185..f01f168b1ac7957e83e8461d734f31be2b26b24b 100644 --- a/cabal-testsuite/cabal-testsuite.cabal +++ b/cabal-testsuite/cabal-testsuite.cabal @@ -29,7 +29,7 @@ common shared build-depends: , base >= 4.6 && <4.14 -- this needs to match the in-tree lib:Cabal version - , Cabal == 3.0.1.0 + , Cabal == 3.0.2.0 ghc-options: -Wall -fwarn-tabs diff --git a/travis-common.sh b/travis-common.sh index 9ea15bf75b6e48497c1b98e839eed9845c4d63c3..eeb587b72087d4d56e9aba483606df3c4939fd58 100644 --- a/travis-common.sh +++ b/travis-common.sh @@ -1,6 +1,6 @@ set -e -CABAL_VERSION="3.0.1.0" +CABAL_VERSION="3.0.2.0" CABAL_INSTALL_VERSION="3.0.1.0" if [ "$TRAVIS_OS_NAME" = "linux" ]; then