Skip to content

Conversation

@ffaf1
Copy link
Collaborator

@ffaf1 ffaf1 commented Nov 12, 2025

Backport #11275


  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? No. If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

ulysses4ever and others added 30 commits September 10, 2024 03:34
* changelogs for Cabal-3.14 and (incomplete) cabal-install-3.16

* cleanup changelog-d files afer creating the 3.14 changelog

* Apply suggestions from geekosaur

Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>

* Apply more suggestions from geekosaur

* Apply suggestions from geekosaur (contd.)

Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>

---------

Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>
It includes a compatible hackage-security
[3.14] Bump version numbers to 3.14
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 3a6f73e)
* Bumpo “Redefine `build-type: Configure`” importance

* Move “`pkg-config` error message” entry

to “Other changes”

* Fix typo

* cabal file → `.cabal` file

* Remove haskell#9702 from `cabal-install` changelog

It is invisible to `cabal-install` user

* Changelog: add OrPatterns extension

* Changelog: add SPDX note

* Make release notes for cabal-install 3.14

We are after all releasing cabal-install 3.14

* Fix SPDX entry

We are not doing the sensible thing anymore.
* Handle 3D Slicer licence

* Update SPDX license list to version 3.25

* Remove changelog entry

We don't need it, changes have been manually
incorporated in 3.14 release notes (haskell#10338)

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 55c61aa)
Update SPDX license list to version 3.25 (backport haskell#10341)
(cherry picked from commit 7e0db76)
(cherry picked from commit b2e4856)
(cherry picked from commit 8cf9533)
(cherry picked from commit e420708)
This future proofs the code for CLC#285, which will remove
`ErrorCallWithLocation` to de-duplicate duplicate CallStacks.

ErrorCall is already a pattern synonym with the same meaning as it will
have in the future, so this change is backwards compatible too.

(cherry picked from commit db683f2)
Prefer ErrorCall to ErrorCallWithLocation (backport haskell#10404)
…y ways

In the profiling dynamic patch I made a mistake when computing the
needed ways for a build.

When building an executable, the Haskell modules need to be built

* For the final link way
* For the build way of the compiler if TH is enabled

Before this patch, the modules were being built for all the configured
library ways, which built modules in more configurations than the
previous version of Cabal.

Fixes haskell#10418

(cherry picked from commit 27c2668)
Patches the component build ways for foreign library components.
Running ./setup install will give you an error:

```
fromFlag NoFlag. Use fromFlagOrDefault
CallStack (from HasCallStack):
  error, called at src/Distribution/Simple/Flag.hs:110:19 in Cabal-3.15.0.0-inplace:Distribution.Simple.Flag
  fromFlag, called at src/Distribution/Simple/Register.hs:161:16 in Cabal-3.15.0.0-inplace:Distribution.Simple.Register
```

This seems to not be tested anywhere and most people will use ./setup
register in any case, but we should fix this for the next point release
in 3.14 series. # Please enter the commit message for your changes.
Lines starting

Fixes haskell#10416

(cherry picked from commit 2a178f2)
Cabal: Take into account compilerBuildWay when computing final library ways (backport haskell#10419)
`make whitespace` now runs `fix-whitespace --check --verbose` and
`make fix-whitespace` runs `fix-whitespace --verbose`.

(cherry picked from commit 2858dc0)

# Conflicts:
#	.github/workflows/whitespace.yml
mergify bot and others added 26 commits March 29, 2025 01:48
Backport haskell#10776: Fix casing of extra-source-files in Cabal-hooks
…ds a lower bound bump

the function in question is `addInternalBuildToolsFixed`
(introduced in haskell#10838)
Cabal API change in 3.14 requires a lower bound bump in cabal-install
…ernal programs (haskell#10875)

* Revert "cabal-install configureCompiler: configure progdb"

This reverts commit 8bdda9c.

In configureCompiler the call to configureAllKnownPrograms was too
eager. When called it selected the version of tools from PATH (such as
alex), and then when a package was configured these tools were passed
using `--with-alex` options to configure, which meant that the
build-tool-depends versions were not used. (See haskell#10692)

Why was this call introduced in the first place? Because
configureCompiler would a different result depending on whether:

* It is run for the first time, the `ProgramDb` will contain
  unconfigured programs.
* It is run subsequently, `ProgramDb` is read from disk, it does not
  contain unconfigured programs.

Reverting this commit rexposes the bug that the serialised ProgramDb
will not contain UnconfiguredPrograms (in the case where reconfiguring
is avoided).

However, there are no code paths which require this logic in
`cabal-install` currently. The configuration phase happens again each
time that `Cabal` is called, with a populated `ProgramDb`. We will
fix this before the next major `cabal-install` release, but it would not
be suitable to backport.

In the future we will fix this properly by refactoring
`configureCompiler` so that `ProgramDb` is not serialised. The general
approach will be to make `configCompilerEx` return a pair of configured
programs (`ghc` and `ghc-pkg`) and expose an additional function from
`Cabal` which uses these two programs to perform the modifications to
the `ProgramDb` which `configCompilerEx` performs.

Also see haskell#2238 and haskell#9840

Fixes haskell#10692

(cherry picked from commit 1c64bb8)

# Conflicts:
#	cabal-testsuite/PackageTests/ExtraProgPath/setup.out

* Add a test to check that build-tool-depends are used (haskell#10692)

The testcase is not so easy to write because

* The bug only surfaces when the build-tool you are depending on is
  known (ie alex, happy etc)
* But then it is tricky to write a test, as we can't depend on the known
  tools or bundle the source for them.
* So we create a fake "alex", which cabal then invokes on a fake ".x"
  file. This is maybe a bit fragile if the way cabal invokes alex
  changes in future, but then the test can be modified as well.

Ticket haskell#10692

(cherry picked from commit 24f8395)

* Add a test to check that extra-prog-path is honoured for local packages

Whilst fixing haskell#10692, I realised there was also this bug where
extra-prog-path would not be honoured for specific packages.

The idea behind extra-prog-path is that each local package can use a
different version of a preprocessor if desired.

(cherry picked from commit 2c19bf3)

* fixup! fix conflict

---------

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Add version range constraint operator checks

- Check for LEQ upper bounds
- Check for GT lower bounds
- Check for trailing zero upper bounds
- Add missing gtLowerBound to checks
- Handle ^>= versions with its IntersectVersionRangesF
- Set baseline for cabal init generated bounds
- Use recursive functions for checking bounds
- Handle union version ranges
- Update test expectations with --accept in other tests
- Use inclusive lower bound for issue-8646.cabal
- Satisfy the parsimonious test for messages
- Allow exceptions to 25 char limit explain ids
- Rename Is* to Has* to match previous predicates
- Move predicates to VersionRange module
- Add changelog
- Remove unit-test guards that aren't needed
- Shorten check IDs
- Add warnings to cabal check section of user guide
- Terminate bulleted list with full stop
- Remove links to pvp.haskell.org
- Note version constraint guidelines and mistakes
- Add listSep
- Reuse queryVersionRange
- Bundle pattern synonyms with VersionRangeF
- Add doctest docs for version range predicates
- Used named chunk for predicate examples
- Add predicate subsections for types of bounds
- Change lte- to le- prefix
- Satisfy fourmolu
- Flip sense of LE and GT haddocks
- Drop Has prefix on patterns, use LE not LEQ
- avoid name clash with has*Bound (VersionRange -> Bool) predicates
- use TZ not TrailingZero, a two-letter prefix like the other two
- Test expectations with shorter check messages
- Remove unused LANGUAGE pragmas
- Satisfy hlint
- Promote to haddocks, move NOTE about dashes
- Rerun --accept test to generate VersionBound/cabal.out
- rewrite was not triggered by only a trailing whitespace differerence
- Fixup version range of ImpossibleVersionRangeLib
- Fixup version range of NonConfCheck/PackageVersionsInternal
- Fixup version range of NonConfCheck/PackageVersionsInternalSimple
- Fixup version range of NonConfCheck/PackageVersionsLibInt
- Fixup version range of NonConfCheck/PackageVersionsStraddle
- Fixup version range of NonConfCheck/SetupBounds
- Move to DepVersionRange/VersionConstraintOperators
- Move to DepVersionRange/UnboundedInternalDep
- Move to DepVersionRange/InternalLibDep
- Move to DepVersionRange/BaseDep
- Move to DepVersionRange/CustomSetupBaseDep

(cherry picked from commit d46f325)

# Conflicts:
#	Cabal/src/Distribution/PackageDescription/Check/Common.hs
#	Cabal/src/Distribution/PackageDescription/Check/Warning.hs

* fixup! resolve two trivial conflicts

---------

Co-authored-by: Phil de Joux <philderbeast@gmail.com>
Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
(cherry picked from commit 9159c00)
…askell#10733)

* Remove CPP MIN_VERSION_base(4,11,0) in Cabal.Monad

(cherry picked from commit c7f3def)

* Follow hlint suggestion: use fewer imports

- Use fewer imports with CPP in Compat.Time
- Use fewer imports in IntegrationTests2
- Use fewer imports in Distribution.Client.ProjectPlanning
- Use fewer imports in Distribution.Client.Config
- Use fewer imports in Distribution.Client.NixStyleOptions
- Use fewer imports in Internal.TempFile
- Use fewer imports in Distribution.Client.Store
- Use fewer imports in Distribution.Client.SetupWrapper
- Use fewer imports in Disribution.Simple.GHC
- Use fewer imports in NeedleHaystack
- Remove unused -XCPP from Client.ProjectPlanning
- Enable hlint suggestion "Use fewer imports"
- Ignore custom setup test files from Idris and Doctest

(cherry picked from commit 217f08a)

# Conflicts:
#	.hlint.yaml
#	cabal-install/tests/IntegrationTests2.hs
#	cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs

* Bump hlint warning counts

(cherry picked from commit d165dfd)

# Conflicts:
#	.hlint.yaml

* resolve conflicts

* remove redundant imports

* fix style

---------

Co-authored-by: Phil de Joux <philderbeast@gmail.com>
Co-authored-by: Hécate <Kleidukos@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Explains the use of GHC's `-main-is` option in Cabal files, when the usual convention of `Main.main` is not being followed.

(cherry picked from commit f2d9098)
Backport haskell#10833: Complete the documentation of `main-is` field
…g executables (haskell#10887)

* Fix environment variable handling when running executables

This fixes a bug where environment variables were duplicated when running executables.

```
overrideEnv <- fromMaybe [] <$> getEffectiveEnvironment ([("PATH", Just newPath)] ++ envOverrides)
let shellEnv = overrideEnv ++ existingEnv
```

Since getEffectiveEnvironment already calls getEnvironment internally, if any overrides
are passed then the result is a complete environment. Appending it to
the already existing environment results in duplicated environment variables.

The fix:
* Added getFullEnvironment function to handle the common pattern correctly
* Updated code in Bench, Test/ExeV10, Test/LibV09, and Client/Run to use this function

In the future it would be good to generalise `getFullEnvironment`
further so it can also handle the `addLibraryPath` case, which modifies
an environment variable, rather than merely setting or unsetting it.

Fixes haskell#10718

(cherry picked from commit 4375dd5)

* Add test for duplicate environment variables when invoking testsuite

Adds a simple test case that identifies and reports duplicate
environment variables in the Cabal environment.

For issue (haskell#10718)

(cherry picked from commit 6e54b23)

---------

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
…ell#10826)

* Append paths in global config to progdb in `configureCompiler`

* Add test to check global extra-prog-path is used in `configureCompiler`

We add a new PackageTest for cabal-install, which makes sure that the
extra-prog-path in the global config is used when resolving pkg-config
instead of anything already on PATH. We do this by specifying a "bad"
pkg-config to extra-prog-path that returns exit code 1.

On Windows, Cabal logs are identical in the following two cases:
- the override didn't work, and pkg-config was not found on the system
- the override did work, and querying it failed (expectedly)
To work around this, we add a "good" pkg-config script to PATH before-
hand, so that cabal succeeds in the first case and the logs differ.

This test is a stripped down reproduction of what happens when a user on
Windows adds MSYS2 paths to extra-prog-path but not the system PATH.
This is a reasonable setup (often, adding MSYS2 to system PATH is not
good practice), and is even created automatically by GHCup.

* Refactor `configureCompiler` path addition for cleaner variable names

* Remove unnecessary build target from ExtraProgPathGlobal test command

* Fix ExtraProgPathGlobal test failing on Mac/Unix for missing +x perms

* Rename pr-10790 changelog to pr-10826 as it superceded

* Add hashtag before PR/issue numbers in changelog for 10826

---------

Co-authored-by: Javier Sagredo <jasataco@gmail.com>
(cherry picked from commit 74601f4)
Backport haskell#10826: Append paths in global config to progdb in configureCompiler v2
When combining together --dependency and --promised-dependency flags, we
were using `Map.union` in the wrong place. If you had a dependency
and promised-dependency from the same package (ie when using an internal
library) then the promised dependency wouldn't be taken into account.

The fix is straightforward, don't use `Map.union`. First create a list
of everything and then create a map using `fromListWith`.

Fixes haskell#10775

(cherry picked from commit c2cdfc0)
Backport haskell#10841: Fix multi-repl when only building some internal library targets
…lder is created in (haskell#10888)

* testsuite: Set TMPDIR to a specific folder rather than the test root

If things start getting created in the TMPDIR, then it is better to not
place them directly in the project root next to the source and test
files. This also makes it easier to write tests which are sensitive to
what is created in the CWD.

(cherry picked from commit c64a32d)

# Conflicts:
#	cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs
#	cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs
#	cabal-testsuite/src/Test/Cabal/Monad.hs

* cabal-install: Fix the directory the build folder is created in

Clearly this path needs to be relative to the CWD, and the correct
offset is passed as the `srcdir` parameter.

Fixes haskell#10772

(cherry picked from commit 85ef030)

* Add tests which check build/dist-newstyle folders are not created with v2-run

The existing test CmdRun/Script is modified to test the case when v2-run
is executed in a project context. This test checks that a "build" folder
is not created in the CWD (haskell#10772)

A new test is also added which checks what happens in the "no context"
case. A separate bug was fixed in this area recently but no test added
which verifies the change (haskell#10686)

(cherry picked from commit 852430c)

* Quickfix the conflicts in tests; let's see if it works

* Remove test updates for which we lack machinery

* Remove the added test and all the modifications to an old test

---------

Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Co-authored-by: Mikolaj Konarski <mikolaj.konarski@gmail.com>
Move doc files to `extra-doc-files`
Bump open-browser
Remove trailing zeroes from dependency
 Bump version fields of main packages to 3.14.2.0
Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
Cabal 3.14.2 depends on Cabal-syntax at least 3.14.2
@ffaf1 ffaf1 added the backport label Nov 12, 2025
@ffaf1 ffaf1 closed this Nov 12, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 12, 2025

⚠️ The sha of the head commit of this PR conflicts with #11284. Mergify cannot evaluate rules on this PR. ⚠️

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented Nov 14, 2025

⚠️ The sha of the head commit of this PR conflicts with #11284. Mergify cannot evaluate rules on this PR. ⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.