Skip to content

List each datadir variable once in the setup environment - #12552

Open
ulysses4ever wants to merge 4 commits into
haskell:masterfrom
ulysses4ever:planning/one-datadir-var-per-package
Open

ulysses4ever wants to merge 4 commits into
haskell:masterfrom
ulysses4ever:planning/one-datadir-var-per-package

Conversation

@ulysses4ever

@ulysses4ever ulysses4ever commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

A local package's <name>_datadir variable now appears once in the environment of each setup, instead of once for every component of the package. For #12544. Below is the longer story from your friendly AI engine (Opus 5.5).


dataDirsEnvironmentForPlan makes an entry for each in-place unit of the plan, and each component of a package is a unit of its own, with the same variable and the same directory. The list goes to the setup of every component and into the environment of each program it configures, so it is stored in every setup-config about twenty times. As a result, the setup-config files grew with the square of the number of components. This takes the variable once for each package in the plan instead of once for each unit; the variables and their values stay the same.

On a project of 10 packages with 10 components each, after a build:

entries in one setup-config that file all setup-config files
master 2200 369 KB 37.0 MB
this PR 220 194 KB 19.4 MB

The time of a build did not change measurably at this size (12.9 s and 12.6 s).

Testing

DataDirEnvOnce builds a package with three components and checks that each list of environment overrides in the log has the package's datadir variable once; with master's cabal, each list has it three times. DataDirSetupTest, BuildToolDepends and PathRecomp pass locally.


QA Notes

In a package with several components, cabal build -v2 prints "Including the following environment variable overrides:" before each component; each list now has the package's <name>_datadir once, instead of once per component.

🤖 Generated with Claude Code

https://claude.ai/code/session_0176vAefrw8jPKXdh9h1wKuj

dataDirsEnvironmentForPlan made an entry for each in-place unit of the
plan, and each component of a package is a unit of its own, with the same
variable and directory. The list goes to the setup of every component and
into the environment of each program it configures, so setup-config grew
with the square of the number of components.

Drop the duplicates. Found while looking into haskell#12544.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0176vAefrw8jPKXdh9h1wKuj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0176vAefrw8jPKXdh9h1wKuj
Instead of removing the duplicate entries afterwards, take one variable
for each package in the plan: the plan has a unit for each component of a
package, and the variable is the package's. The variables and their
values stay the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0176vAefrw8jPKXdh9h1wKuj
@ulysses4ever
ulysses4ever marked this pull request as ready for review November 14, 2026 14:03
@ulysses4ever
ulysses4ever requested a review from sheaf November 14, 2026 14:04
@mergify mergify Bot added the 👻 haunting the review queue Set by Mergify: no review from anyone with write access two weeks after opening label Nov 22, 2026
@mergify mergify Bot added 1️⃣ more approval needed Set by Mergify: has one of the two required approvals and removed 👻 haunting the review queue Set by Mergify: no review from anyone with write access two weeks after opening labels Dec 4, 2026
Co-authored-by: sheaf <sam.derbyshire@gmail.com>
@ulysses4ever

Copy link
Copy Markdown
Collaborator Author

@michaelpj this works on improving situation with your #12544. Could you provide a review and/or approve? Just one approval left.

@mergify mergify Bot removed the 1️⃣ more approval needed Set by Mergify: has one of the two required approvals label Dec 4, 2026
@ulysses4ever ulysses4ever added squash+merge me Tell Mergify Bot to squash-merge and removed attention: needs-review labels Dec 4, 2026
@mergify mergify Bot added the ready and waiting Mergify is waiting out the cooldown period label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-assisted ready and waiting Mergify is waiting out the cooldown period squash+merge me Tell Mergify Bot to squash-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants