From 7d39aa01b13cac97aef05d3d085185b9767bc580 Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Thu, 28 Jun 2018 09:54:26 +0100 Subject: [PATCH] Knock the pre-distribution checks down to just warnings --- Cabal/Distribution/PackageDescription/Check.hs | 7 +++++-- .../PackageTests/Check/MissingGlobDirectory/cabal.out | 2 +- .../PackageTests/Check/MissingGlobDirectory2/cabal.out | 3 +-- .../PackageTests/Check/MissingGlobDirectory2/cabal.test.hs | 3 +-- cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out | 3 +-- .../PackageTests/Check/NoGlobMatches/cabal.test.hs | 3 +-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Cabal/Distribution/PackageDescription/Check.hs b/Cabal/Distribution/PackageDescription/Check.hs index 19d7922bb01..ab845fc8ca8 100644 --- a/Cabal/Distribution/PackageDescription/Check.hs +++ b/Cabal/Distribution/PackageDescription/Check.hs @@ -2157,6 +2157,9 @@ checkTarPath path -- and package-creation environment. Hence we can use IO, rather than needing -- to pass a 'CheckPackageContentOps' dictionary around. checkPackageFilesPreDistribution :: Verbosity -> PackageDescription -> FilePath -> NoCallStackIO [PackageCheck] +-- Note: this really shouldn't return any 'Inexcusable' warnings, +-- because that will make us say that Hackage would reject the package. +-- But, because Hackage doesn't run these tests, that will be a lie! checkPackageFilesPreDistribution = checkGlobFiles -- | Discover problems with the package's wildcards. @@ -2169,7 +2172,7 @@ checkGlobFiles verbosity pkg root = results <- matchDirFileGlob' verbosity (specVersion pkg) (root dir) glob let individualWarnings = results >>= getWarning field glob noMatchesWarning = - [ PackageDistInexcusable $ + [ PackageDistSuspiciousWarn $ "In '" ++ field ++ "': the pattern '" ++ glob ++ "' does not" ++ " match any files." | all (not . suppressesNoMatchesWarning) results @@ -2206,7 +2209,7 @@ checkGlobFiles verbosity pkg root = ++ " To enable looser suffix-only matching, set 'cabal-version: 2.4' or higher." ] getWarning field glob (GlobMissingDirectory dir) = - [ PackageDistInexcusable $ + [ PackageDistSuspiciousWarn $ "In '" ++ field ++ "': the pattern '" ++ glob ++ "' attempts to" ++ " match files in the directory '" ++ dir ++ "', but there is no" ++ " directory by that name." diff --git a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory/cabal.out b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory/cabal.out index c9cc011d477..763ba68448e 100644 --- a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory/cabal.out +++ b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory/cabal.out @@ -1,7 +1,7 @@ # cabal check Warning: The package will not build sanely due to these errors: Warning: This package description follows version 2.4 of the Cabal specification. This tool only supports up to version 2.3.0.0. -Warning: The following errors will cause portability problems on other environments: +Warning: These warnings may cause trouble when distributing the package: Warning: In 'data-files': the pattern 'another-non-existent-directory/**/*.dat' attempts to match files in the directory 'another-non-existent-directory', but there is no directory by that name. Warning: In 'extra-doc-files': the pattern 'non-existent-directory/*.html' attempts to match files in the directory 'non-existent-directory', but there is no directory by that name. Warning: In 'extra-doc-files': the pattern 'present/present/missing/*.tex' attempts to match files in the directory 'present/present/missing', but there is no directory by that name. diff --git a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.out b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.out index 5262079d751..37218037ad2 100644 --- a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.out +++ b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.out @@ -1,4 +1,3 @@ # cabal check -Warning: The following errors will cause portability problems on other environments: +Warning: These warnings may cause trouble when distributing the package: Warning: In 'data-files': the pattern 'non-existent-directory/*.dat' attempts to match files in the directory 'non-existent-directory', but there is no directory by that name. -Warning: Hackage would reject this package. diff --git a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.test.hs b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.test.hs index 3e2d39fa5bc..38f3844d593 100644 --- a/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.test.hs @@ -1,3 +1,2 @@ import Test.Cabal.Prelude -main = cabalTest $ - fails $ cabal "check" [] +main = cabalTest $ cabal "check" [] diff --git a/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out b/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out index f71810da9ce..86d46d6e405 100644 --- a/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out +++ b/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out @@ -1,4 +1,3 @@ # cabal check -Warning: The following errors will cause portability problems on other environments: +Warning: These warnings may cause trouble when distributing the package: Warning: In 'extra-doc-files': the pattern '*.html' does not match any files. -Warning: Hackage would reject this package. diff --git a/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.test.hs b/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.test.hs index 3e2d39fa5bc..38f3844d593 100644 --- a/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.test.hs @@ -1,3 +1,2 @@ import Test.Cabal.Prelude -main = cabalTest $ - fails $ cabal "check" [] +main = cabalTest $ cabal "check" []