Skip to content

Commit

Permalink
Merge branch 'master' into purge-gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleidukos authored Nov 17, 2023
2 parents 8edddae + b368a38 commit fbf1f85
Show file tree
Hide file tree
Showing 92 changed files with 4,843 additions and 3,271 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,13 @@ jobs:
# Have to disable *-suite validation:
# - the Windows@9.6.1 problem is tracked at https://github.com/haskell/cabal/issues/8858
# - but curently can't run it with GHC 9.6, tracking: https://github.com/haskell/cabal/issues/8883
if: (runner.os != 'Windows') || (matrix.ghc != '9.6.3')
run: sh validate.sh $FLAGS -s lib-suite

- name: Validate cli-tests
run: sh validate.sh $FLAGS -s cli-tests

- name: Validate cli-suite
# Have to disable *-suite validation, see above the comment for lib-suite
if: (runner.os != 'Windows') || (matrix.ghc != '9.6.3')
run: sh validate.sh $FLAGS -s cli-suite

validate-old-ghcs:
Expand Down
23 changes: 14 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ cabal build cabal-tests # etc...
Running tests
-------------

**Using Github Actions.**
**Using GitHub Actions.**
If you are not in a hurry, the most convenient way to run tests on Cabal
is to make a branch on GitHub and then open a pull request; our
continuous integration service on Github Actions builds and
continuous integration service on GitHub Actions builds and
tests your code. Title your PR with WIP so we know that it does not need
code review.

Some tips for using Github Actions effectively:
Some tips for using GitHub Actions effectively:

* Github Actions builds take a long time. Use them when you are pretty
* GitHub Actions builds take a long time. Use them when you are pretty
sure everything is OK; otherwise, try to run relevant tests locally
first.

* Watch over your jobs on the [Github Actions website](http://github.org/haskell/cabal/actions).
* Watch over your jobs on the [GitHub Actions website](http://github.org/haskell/cabal/actions).
If you know a build of yours is going to fail (because one job has
already failed), be nice to others and cancel the rest of the jobs,
so that other commits on the build queue can be processed.
Expand All @@ -75,9 +75,9 @@ failures:
a specific operating system? If so, try reproducing the
problem on the specific configuration.

4. Is the test failing on a Github Actions per-GHC build.
4. Is the test failing on a GitHub Actions per-GHC build.
In this case, if you click on "Branch", you can get access to
the precise binaries that were built by Github Actions that are being
the precise binaries that were built by GitHub Actions that are being
tested. If you have an Ubuntu system, you can download
the binaries and run them directly.

Expand Down Expand Up @@ -176,7 +176,7 @@ Other Conventions
* Our GHC support window is five years for the Cabal library and three
years for cabal-install: that is, the Cabal library must be
buildable out-of-the-box with the dependencies that shipped with GHC
for at least five years. The Travis CI checks this, so most
for at least five years. GitHub Actions checks this, so most
developers submit a PR to see if their code works on all these
versions of GHC. `cabal-install` must also be buildable on all
supported GHCs, although it does not have to be buildable
Expand Down Expand Up @@ -218,7 +218,7 @@ GitHub Ticket Conventions

Each major `Cabal`/`cabal-install` release (e.g. 3.4, 3.6, etc.) has a
corresponding GitHub Project and milestone. A ticket is included in a release's
project if the release managers are tenatively planning on including a fix for
project if the release managers are tentatively planning on including a fix for
the ticket in the release, i.e. if they are actively seeking someone to work on
the ticket.

Expand Down Expand Up @@ -247,6 +247,11 @@ If your pull request consists of several commits, consider using `squash+merge
me` instead of `merge me`: the Mergify bot will squash all the commits into one
and concatenate the commit messages of the commits before merging.

There is also a `merge+no rebase` label. Use this very sparingly, as not rebasing
severely complicates Git history. It is intended for special circumstances, as when
the PR branch cannot or should not be modified. If you have any questions about it,
please ask us.

Changelog
---------

Expand Down
14 changes: 1 addition & 13 deletions Cabal-syntax/src/Distribution/Types/Benchmark.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,12 @@ instance Monoid Benchmark where
instance Semigroup Benchmark where
a <> b =
Benchmark
{ benchmarkName = combine' benchmarkName
{ benchmarkName = combineNames a b benchmarkName "benchmark"
, benchmarkInterface = combine benchmarkInterface
, benchmarkBuildInfo = combine benchmarkBuildInfo
}
where
combine field = field a `mappend` field b
combine' field = case ( unUnqualComponentName $ field a
, unUnqualComponentName $ field b
) of
("", _) -> field b
(_, "") -> field a
(x, y) ->
error $
"Ambiguous values for test field: '"
++ x
++ "' and '"
++ y
++ "'"

emptyBenchmark :: Benchmark
emptyBenchmark = mempty
Expand Down
14 changes: 1 addition & 13 deletions Cabal-syntax/src/Distribution/Types/Executable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,13 @@ instance Monoid Executable where
instance Semigroup Executable where
a <> b =
Executable
{ exeName = combine' exeName
{ exeName = combineNames a b exeName "executable"
, modulePath = combine modulePath
, exeScope = combine exeScope
, buildInfo = combine buildInfo
}
where
combine field = field a `mappend` field b
combine' field = case ( unUnqualComponentName $ field a
, unUnqualComponentName $ field b
) of
("", _) -> field b
(_, "") -> field a
(x, y) ->
error $
"Ambiguous values for executable field: '"
++ x
++ "' and '"
++ y
++ "'"

emptyExecutable :: Executable
emptyExecutable = mempty
Expand Down
14 changes: 1 addition & 13 deletions Cabal-syntax/src/Distribution/Types/ForeignLib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ instance NFData ForeignLib where rnf = genericRnf
instance Semigroup ForeignLib where
a <> b =
ForeignLib
{ foreignLibName = combine' foreignLibName
{ foreignLibName = combineNames a b foreignLibName "foreign library"
, foreignLibType = combine foreignLibType
, foreignLibOptions = combine foreignLibOptions
, foreignLibBuildInfo = combine foreignLibBuildInfo
Expand All @@ -150,18 +150,6 @@ instance Semigroup ForeignLib where
}
where
combine field = field a `mappend` field b
combine' field = case ( unUnqualComponentName $ field a
, unUnqualComponentName $ field b
) of
("", _) -> field b
(_, "") -> field a
(x, y) ->
error $
"Ambiguous values for executable field: '"
++ x
++ "' and '"
++ y
++ "'"
combine'' field = field b

instance Monoid ForeignLib where
Expand Down
14 changes: 1 addition & 13 deletions Cabal-syntax/src/Distribution/Types/TestSuite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,13 @@ instance Monoid TestSuite where
instance Semigroup TestSuite where
a <> b =
TestSuite
{ testName = combine' testName
{ testName = combineNames a b testName "test"
, testInterface = combine testInterface
, testBuildInfo = combine testBuildInfo
, testCodeGenerators = combine testCodeGenerators
}
where
combine field = field a `mappend` field b
combine' field = case ( unUnqualComponentName $ field a
, unUnqualComponentName $ field b
) of
("", _) -> field b
(_, "") -> field a
(x, y) ->
error $
"Ambiguous values for test field: '"
++ x
++ "' and '"
++ y
++ "'"

emptyTestSuite :: TestSuite
emptyTestSuite = mempty
Expand Down
33 changes: 32 additions & 1 deletion Cabal-syntax/src/Distribution/Types/UnqualComponentName.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ module Distribution.Types.UnqualComponentName
, mkUnqualComponentName
, packageNameToUnqualComponentName
, unqualComponentNameToPackageName
, combineNames
) where

import Distribution.Compat.Prelude
import Distribution.Utils.ShortText
import Prelude ()
import Prelude as P (null)

import Distribution.Parsec
import Distribution.Pretty
Expand Down Expand Up @@ -105,3 +106,33 @@ packageNameToUnqualComponentName = UnqualComponentName . unPackageNameST
-- @since 2.0.0.2
unqualComponentNameToPackageName :: UnqualComponentName -> PackageName
unqualComponentNameToPackageName = mkPackageNameST . unUnqualComponentNameST

-- | Combine names in targets if one name is empty or both names are equal
-- (partial function).
-- Useful in 'Semigroup' and similar instances.
combineNames
:: a
-> a
-> (a -> UnqualComponentName)
-> String
-> UnqualComponentName
combineNames a b tacc tt
-- One empty or the same.
| P.null unb
|| una == unb =
na
| P.null una = nb
-- Both non-empty, different.
| otherwise =
error $
"Ambiguous values for "
++ tt
++ " field: '"
++ una
++ "' and '"
++ unb
++ "'"
where
(na, nb) = (tacc a, tacc b)
una = unUnqualComponentName na
unb = unUnqualComponentName nb
2 changes: 1 addition & 1 deletion Cabal-tests/tests/CheckTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ checkTest fp = cabalGoldenTest fp correct $ do
-- Note: parser warnings are reported by `cabal check`, but not by
-- D.PD.Check functionality.
unlines (map (showPWarning fp) ws) ++
unlines (map show (checkPackage gpd Nothing))
unlines (map show (checkPackage gpd))
Left (_, errs) -> unlines $ map (("ERROR: " ++) . showPError fp) $ NE.toList errs
where
input = "tests" </> "ParserTests" </> "regressions" </> fp
Expand Down
2 changes: 1 addition & 1 deletion Cabal-tests/tests/HackageTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ parseCheckTest fpath bs = do
Parsec.parseGenericPackageDescription bs
case parsec of
Right gpd -> do
let checks = checkPackage gpd Nothing
let checks = checkPackage gpd
let w [] = 0
w _ = 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
These packages miss upper bounds:
On library, these packages miss upper bounds:
- somelib
- alphalib
- betalib
- deltalib
- somelib
Please add them, using `cabal gen-bounds` for suggestions. For more information see: https://pvp.haskell.org/
Please add them. There is more information at https://pvp.haskell.org/
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
In the 'extra-source-files' field: invalid file glob 'foo/blah-*.hs'. Wildcards '*' may only totally replace the file's base name, not only parts of it.
In the 'extra-source-files' field: invalid file glob 'foo/*/bar'. A wildcard '**' is only allowed as the final parent directory. Stars must not otherwise appear in the parent directories.
In the 'extra-source-files' field: invalid file glob 'foo/blah-*.hs'. Wildcards '*' may only totally replace the file's base name, not only parts of it.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Flag UseBinary
Description: Use the binary package for serializing keys.

Library
build-depends: base >= 3
build-depends: base < 3
if flag(UseBinary)
build-depends: binary <10
CPP-Options: -DUSE_BINARY
Expand All @@ -34,7 +34,7 @@ Library
exposed-modules: Codec.Crypto.RSA

Executable test_rsa
build-depends: base >= 3
build-depends: base < 3
CPP-Options: -DRSA_TEST
Main-Is: Test.hs
Other-Modules: Codec.Crypto.RSA
Expand All @@ -52,7 +52,7 @@ Executable warnings

-- Increasing indentation is also possible if we use braces to delimit field contents.
Executable warnings2
build-depends: { base <5 }
build-depends: { base < 5 }
main-is: { warnings2.hs }
Other-Modules: FooBar

Expand All @@ -62,9 +62,9 @@ flag splitBase

Executable warnings3
if flag(splitBase)
build-depends: base >= 3
build-depends: base < 3
else
build-depends: base < 3
build-depends: base < 5

Main-Is: warnings3.hs
Other-Modules:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
The paths 'files/<>/*.txt', 'c/**/*.c', 'C:foo/bar', '||s' are invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'.
The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
'extra-source-files: files/**/*.txt/' is not a good relative path: "trailing slash"
'extra-source-files: files/../foo.txt' is not a good relative path: "parent directory segment: .."
'license-file: LICENSE2/' is not a good relative path: "trailing slash"
'license-file: .' is not a good relative path: "trailing dot segment"
'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/.' is not a good relative path: "trailing same directory segment: ."
'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
'license-file: .' is not a good relative path: "trailing dot segment"
'license-file: LICENSE2/' is not a good relative path: "trailing slash"
The path 'C:foo/bar' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
The path 'c/**/*.c' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
The path 'files/<>/*.txt' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
The path '||s' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
4 changes: 2 additions & 2 deletions Cabal-tests/tests/ParserTests/regressions/ghc-option-j.check
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
'ghc-options: -j[N]' can make sense for specific user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
'ghc-shared-options: -j[N]' can make sense for specific user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
'ghc-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
'ghc-shared-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
4 changes: 2 additions & 2 deletions Cabal-tests/tests/ParserTests/regressions/issue-774.check
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
issue-774.cabal:13:22: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.12'.
'ghc-options: -rtsopts' has no effect for libraries. It should only be used for executables.
'ghc-options: -with-rtsopts' has no effect for libraries. It should only be used for executables.
No 'category' field.
No 'maintainer' field.
The 'license' field is missing or is NONE.
'ghc-options: -rtsopts' has no effect for libraries. It should only be used for executables.
'ghc-options: -with-rtsopts' has no effect for libraries. It should only be used for executables.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ No 'category' field.
No 'maintainer' field.
No 'description' field.
The 'license' field is missing or is NONE.
Suspicious flag names: 無. To avoid ambiguity in command line interfaces, flag shouldn't start with a dash. Also for better compatibility, flag names shouldn't contain non-ascii characters.
Suspicious flag names: 無. To avoid ambiguity in command line interfaces, a flag shouldn't start with a dash. Also for better compatibility, flag names shouldn't contain non-ascii characters.
Non ascii custom fields: x-無. For better compatibility, custom field names shouldn't contain non-ascii characters.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
In the 'data-files' field: invalid file glob 'foo/**/*.dat'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-source-files' field: invalid file glob 'foo/**/*.hs'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-doc-files' field: invalid file glob 'foo/**/*.html'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-source-files' field: invalid file glob 'foo/**/*.hs'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
6 changes: 6 additions & 0 deletions Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ library
Distribution.Compat.SnocList
Distribution.GetOpt
Distribution.Lex
Distribution.PackageDescription.Check.Common
Distribution.PackageDescription.Check.Conditional
Distribution.PackageDescription.Check.Monad
Distribution.PackageDescription.Check.Paths
Distribution.PackageDescription.Check.Target
Distribution.PackageDescription.Check.Warning
Distribution.Simple.Build.Macros.Z
Distribution.Simple.Build.PackageInfoModule.Z
Distribution.Simple.Build.PathsModule.Z
Expand Down
Loading

0 comments on commit fbf1f85

Please sign in to comment.