Skip to content

Commit 22d9d8f

Browse files
authored
Merge branch 'master' into haiku-as-platform
2 parents 1c8afa1 + 1cb92a3 commit 22d9d8f

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

Cabal/src/Distribution/PackageDescription/Check.hs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import System.FilePath
7979
, (</>)
8080
)
8181

82+
import qualified Control.Monad as CM
8283
import qualified Data.ByteString.Lazy as BS
8384
import qualified Data.Map as Map
8485
import qualified Distribution.Compat.DList as DList
@@ -2109,7 +2110,7 @@ checkPackageVersions pkg =
21092110
else baseErrors
21102111
where
21112112
baseErrors = PackageDistInexcusable BaseNoUpperBounds <$ bases
2112-
deps = toDependencyVersionsMap allBuildDepends pkg
2113+
deps = toDependencyVersionsMap allNonInternalBuildDepends pkg
21132114
-- base gets special treatment (it's more critical)
21142115
(bases, others) =
21152116
partition (("base" ==) . unPackageName) $
@@ -2118,6 +2119,16 @@ checkPackageVersions pkg =
21182119
, not (hasUpperBound vr)
21192120
]
21202121

2122+
-- Get the combined build-depends entries of all components.
2123+
allNonInternalBuildDepends :: PackageDescription -> [Dependency]
2124+
allNonInternalBuildDepends = targetBuildDepends CM.<=< allNonInternalBuildInfo
2125+
2126+
allNonInternalBuildInfo :: PackageDescription -> [BuildInfo]
2127+
allNonInternalBuildInfo pkg_descr =
2128+
[bi | lib <- allLibraries pkg_descr, let bi = libBuildInfo lib]
2129+
++ [bi | flib <- foreignLibs pkg_descr, let bi = foreignLibBuildInfo flib]
2130+
++ [bi | exe <- executables pkg_descr, let bi = buildInfo exe]
2131+
21212132
checkConditionals :: GenericPackageDescription -> [PackageCheck]
21222133
checkConditionals pkg =
21232134
catMaybes
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# cabal check
2+
No errors or warnings could be found in the package.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Test.Cabal.Prelude
2+
3+
-- Internal targets (tests, benchmarks) should not be checked.
4+
main = cabalTest $
5+
cabal "check" []
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cabal-version: 3.0
2+
name: pkg
3+
synopsis: synopsis
4+
description: description
5+
version: 0
6+
category: example
7+
maintainer: [email protected]
8+
license: GPL-3.0-or-later
9+
10+
library
11+
exposed-modules: Foo
12+
default-language: Haskell2010
13+
build-depends: base == 2.2.*
14+
15+
test-suite test
16+
type: exitcode-stdio-1.0
17+
main-is: Test.hs
18+
default-language: Haskell2010
19+
build-depends: base == 2.2.*,
20+
criterion
21+

changelog.d/pr-9004

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: Do not check PVP on internal targets
2+
packages: cabal-install
3+
prs: #9004
4+
issues: #8361
5+
6+
description: {
7+
8+
- `cabal check` will not check for dependencies upper bounds in internal
9+
targets (i.e. test-suites and benchmarks)
10+
11+
}

0 commit comments

Comments
 (0)