Skip to content

Commit

Permalink
Merge branch '3.10' into mergify/bp/3.10/pr-9134
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo authored Dec 22, 2023
2 parents a11f27c + 5fefcf5 commit 65c5a64
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ data CheckExplanation =
| CVExpliticDepsCustomSetup
| CVAutogenPaths
| CVAutogenPackageInfo
| CVAutogenPackageInfoGuard
| GlobNoMatch String String
| GlobExactMatch String String FilePath
| GlobNoDir String String FilePath
Expand Down Expand Up @@ -664,6 +665,11 @@ ppExplanation CVAutogenPackageInfo =
++ "the module does not come with the package and is generated on "
++ "setup. Modules built with a custom Setup.hs script also go here "
++ "to ensure that commands like sdist don't fail."
ppExplanation CVAutogenPackageInfoGuard =
"To use the autogenerated module PackageInfo_* you need to specify "
++ "`cabal-version: 3.12` or higher. This is not possible in `cabal "
++ "3.10`. To use this feature and be able to upload your package to "
++ "Hackage, download `cabal 3.12`!"
ppExplanation (GlobNoMatch field glob) =
"In '" ++ field ++ "': the pattern '" ++ glob ++ "' does not"
++ " match any files."
Expand Down Expand Up @@ -1814,6 +1820,9 @@ checkCabalVersion pkg =
&& not (elem (autogenPackageInfoModuleName pkg) allModuleNamesAutogen) ) $
PackageDistInexcusable CVAutogenPackageInfo

, check
(elem (autogenPackageInfoModuleName pkg) allModuleNames)
(PackageDistInexcusable CVAutogenPackageInfoGuard)
]
where
-- Perform a check on packages that use a version of the spec less than
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ On test suite 'Test' an 'autogen-module' is not on 'other-modules'
On benchmark 'Bench' an 'autogen-module' is not on 'other-modules'
Packages using 'cabal-version: 2.0' and the autogenerated module Paths_* must include it also on the 'autogen-modules' field besides 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
Packages using 'cabal-version: 2.0' and the autogenerated module PackageInfo_* must include it in 'autogen-modules' as well as 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
The filename './my.cabal' does not match package name (expected: 'AutogenModules.cabal')
Note: the public hackage server would reject this package.
Building source dist for AutogenModules-0.1...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ On test suite 'Test' an 'autogen-module' is not on 'other-modules'
On benchmark 'Bench' an 'autogen-module' is not on 'other-modules'
Packages using 'cabal-version: 2.0' and the autogenerated module Paths_* must include it also on the 'autogen-modules' field besides 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
Packages using 'cabal-version: 2.0' and the autogenerated module PackageInfo_* must include it in 'autogen-modules' as well as 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
The filename './my.cabal' does not match package name (expected: 'AutogenModules.cabal')
Note: the public hackage server would reject this package.
Building source dist for AutogenModules-0.1...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Setup configure
Configuring AutogenModules-0.1...
# Setup sdist
Distribution quality errors:
To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
Note: the public hackage server would reject this package.
Building source dist for AutogenModules-0.1...
Source tarball created: setup.cabal.dist/work/dist/AutogenModules-0.1.tar.gz
# Setup sdist
Expand Down
3 changes: 3 additions & 0 deletions cabal-testsuite/PackageTests/AutogenModules/SrcDist/setup.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Setup configure
Configuring AutogenModules-0.1...
# Setup sdist
Distribution quality errors:
To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
Note: the public hackage server would reject this package.
Building source dist for AutogenModules-0.1...
Source tarball created: setup.dist/work/dist/AutogenModules-0.1.tar.gz
# Setup sdist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ main = setupAndCabalTest $ do
assertOutputDoesNotContain pathsAutogenMsg configureResult

-- Asserts for the undesired check messages after sdist.
assertOutputDoesNotContain "Distribution quality errors:" sdistResult
assertOutputDoesNotContain libAutogenMsg sdistResult
assertOutputDoesNotContain exeAutogenMsg sdistResult
assertOutputDoesNotContain testAutogenMsg sdistResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Warning: The following errors will cause portability problems on other environments:
Warning: Packages using 'cabal-version: 2.0' and the autogenerated module Paths_* must include it also on the 'autogen-modules' field besides 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
Warning: Packages using 'cabal-version: 2.0' and the autogenerated module PackageInfo_* must include it in 'autogen-modules' as well as 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail.
Warning: To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cabal check
Warning: The following errors will cause portability problems on other environments:
Warning: To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
Warning: Hackage would reject this package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Test.Cabal.Prelude

-- #9331: PackageInfo functionality should be guarded by cabal-version.
main = cabalTest $
fails $ cabal "check" []

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cabal-version: 2.4
name: pkg
version: 0
license: GPL-3.0-or-later
maintainer: Someone
category: Example
synopsis: Foo
description: FooBar
build-type: Simple

library
default-language: Haskell2010
build-depends: base <5
autogen-modules: PackageInfo_pkg
exposed-modules: PackageInfo_pkg

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
Warning: The package will not build sanely due to these errors:
Warning: Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module Paths_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a Paths_* autogen module, specify at least 'cabal-version: 2.2'.
Warning: Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module PackageInfo_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a PackageInfo_* autogen module, specify at least 'cabal-version: 2.2'.
Warning: The following errors will cause portability problems on other environments:
Warning: To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. This is not possible in `cabal 3.10`. To use this feature and be able to upload your package to Hackage, download `cabal 3.12`!
Warning: Hackage would reject this package.
10 changes: 10 additions & 0 deletions changelog.d/pr-9525
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
synopsis: `check`: add PackageInfo warning
packages: cabal-install
prs: #9525
issues: #9331

description: {

`cabal check` will warn about PackageInfo_* modules and provide an upgrade path to 3.12.

}

0 comments on commit 65c5a64

Please sign in to comment.