From 3a37b8e02c1abf16627f47ca9cbbfb1390977ef7 Mon Sep 17 00:00:00 2001 From: Francesco Ariis Date: Tue, 6 Jun 2023 10:58:24 +0200 Subject: [PATCH] Do not check PVP on internal targets Internal: testsuite, benchmark. See #8361. --- .../PackageDescription/Check/Target.hs | 14 +++++++++++++- doc/cabal-commands.rst | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Cabal/src/Distribution/PackageDescription/Check/Target.hs b/Cabal/src/Distribution/PackageDescription/Check/Target.hs index 8b3e12dc746..ceda9ed83a1 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Target.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Target.hs @@ -338,7 +338,9 @@ checkBuildInfo cet ams ads bi = do let ick = const (PackageDistInexcusable BaseNoUpperBounds) rck = PackageDistSuspiciousWarn . MissingUpperBounds cet checkPVP ick ids - checkPVPs rck rds + unless + (isInternalTarget cet) + (checkPVPs rck rds) -- Custom fields well-formedness (ASCII). mapM_ checkCustomField (customFieldsBI bi) @@ -728,6 +730,16 @@ mergeDependencies l@(d : _) = depName :: Dependency -> String depName wd = unPackageName . depPkgName $ wd +-- Is this an internal target? We do not perform PVP checks on those, +-- see https://github.com/haskell/cabal/pull/8361#issuecomment-1577547091 +isInternalTarget :: CEType -> Bool +isInternalTarget (CETLibrary{}) = False +isInternalTarget (CETForeignLibrary{}) = False +isInternalTarget (CETExecutable{}) = False +isInternalTarget (CETTest{}) = True +isInternalTarget (CETBenchmark{}) = True +isInternalTarget (CETSetup{}) = False + -- ------------------------------------------------------------ -- Options -- ------------------------------------------------------------ diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index e1f7243bfb0..214f6b8c634 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -1133,7 +1133,7 @@ A list of all warnings with their constructor: - UnknownArch: unknown architecture in condition. - UnknownCompiler: unknown compiler in condition. - BaseNoUpperBounds: missing upper bounds for important dependencies (``base``, and for ``custom-setup`` ``Cabal`` too). -- MissingUpperBounds: missing upper bound in dependency. +- MissingUpperBounds: missing upper bound in dependency (excluding test-suites and benchmarks). - SuspiciousFlagName: troublesome flag name (e.g. starting with a dash). - DeclaredUsedFlags: unused user flags. - NonASCIICustomField: non-ASCII characters in custom field.