Skip to content

Conversation

@sgillespie
Copy link
Collaborator

@sgillespie sgillespie commented Oct 28, 2025

This addds the GHC Project Unit ID store path to the cabal path output as "project-unit-id". The GHC "Project Unit ID" store path has been used in cabal-install since 3.12.1.0.

Example output:

compiler-flavour: ghc
compiler-id: ghc-9.10.1
compiler-path: /nix/store/367sp8xqvk70a050fm6f8a93lig0gx41-ghc-9.10.1/bin/ghc
compiler-store-path: /home/sgillespie/.local/state/cabal/store/ghc-9.10.1-be9a
cache-home: /home/sgillespie/.cache/cabal
remote-repo-cache: /home/sgillespie/.cache/cabal/packages
logs-dir: /home/sgillespie/.cache/cabal/logs
store-dir: /home/sgillespie/.local/state/cabal/store
config-file: /home/sgillespie/.config/cabal/config
installdir: /home/sgillespie/.local/bin

Note that the new value is "project-unit-id", although I'm not 100% this makes sense. Let me know if there's a better name.

EDIT: Changed name to "compiler-store-path"


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@sgillespie sgillespie changed the title Add GHC Unit ID store to cabal path output WIP: Add GHC Unit ID store to cabal path output Oct 28, 2025
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from f077536 to 248e488 Compare October 28, 2025 14:11
sgillespie added a commit to sgillespie/cabal that referenced this pull request Oct 29, 2025
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
sgillespie added a commit to sgillespie/cabal that referenced this pull request Oct 29, 2025
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from 54ebf30 to 1703168 Compare October 29, 2025 21:05
sgillespie added a commit to sgillespie/cabal that referenced this pull request Oct 29, 2025
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from 1703168 to eae337e Compare October 29, 2025 21:08
@fendor
Copy link
Collaborator

fendor commented Oct 29, 2025

The value of project-unit-id looks to me like the store dir that is actually used for this particular project. So perhaps, project-store-dir or compiler-store-dir is more fitting?

sgillespie added a commit to sgillespie/cabal that referenced this pull request Oct 29, 2025
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from eae337e to bb796cb Compare October 29, 2025 21:10
@fendor
Copy link
Collaborator

fendor commented Oct 30, 2025

Also, perhaps we want to print the compiler paired with its abi hash as well?

@sgillespie
Copy link
Collaborator Author

sgillespie commented Oct 30, 2025

Also, perhaps we want to print the compiler paired with its abi hash as well?

Say, something like this?

compiler-abi-hash: ghc-9.10.1-b7a5c6aad95a5a3e4903ce2272ab85e0

sgillespie added a commit to sgillespie/cabal that referenced this pull request Oct 30, 2025
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from d83bb90 to e8a1785 Compare October 30, 2025 13:33
@sgillespie sgillespie changed the title WIP: Add GHC Unit ID store to cabal path output Add GHC Unit ID store to cabal path output Oct 30, 2025
@sgillespie sgillespie marked this pull request as ready for review October 30, 2025 13:34
@fendor
Copy link
Collaborator

fendor commented Oct 30, 2025

exactly! Then the field compiler-store-path would be strictly speaking redundant, but that's fine, imo.

@sgillespie
Copy link
Collaborator Author

exactly! Then the field compiler-store-path would be strictly speaking redundant, but that's fine, imo.

Wait, am I doing abi-hash, as in ghc --abi-hash, or the abi-tag, as in Distribution.Compiler.AbiTag? If it is the hash, I can't seem to find an straightforward way to get that, what should my strategy be?

@fendor
Copy link
Collaborator

fendor commented Nov 4, 2025

Ah, slight misunderstanding! I think adding the output of ghc --abi-hash is not necessary, as we provide the ghc executable path, and it is only one quick invocation of ghc away to get ghc --abi-hash.

Assuming /home/sgillespie/.local/state/cabal/store/ghc-9.10.1-be9a, I was referring to be9a, but if that's tricky right now to get out, I'd be fine with current change.

@ulysses4ever
Copy link
Collaborator

This is a small patch so it'd be a good addition to 3.16.1.0 but there's no reviews :-(

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a test to cabal-testsuite/PackageTests/Path/Compiler/cabal.test.hs, roughly like:

void $ cabal "path" ["-z", "--store-dir", "fake-dir", "--compiler-info"]

As the output compiler-store-path should be affected by explicit configuration, iirc?

Perhaps it should even be a test in cabal-testsuite/PackageTests/Path/Config/cabal.test.hs, but I think it might be slightly more tricky to come up with a good test.

Otherwise, I think this is a good addition and Ill approve the PR, once the test has been added.

@sgillespie
Copy link
Collaborator Author

sgillespie commented Nov 11, 2025

Could we add a test to cabal-testsuite/PackageTests/Path/Compiler/cabal.test.hs, roughly like:

void $ cabal "path" ["-z", "--store-dir", "fake-dir", "--compiler-info"]

As the output compiler-store-path should be affected by explicit configuration, iirc?

Perhaps it should even be a test in cabal-testsuite/PackageTests/Path/Config/cabal.test.hs, but I think it might be slightly more tricky to come up with a good test.

Otherwise, I think this is a good addition and Ill approve the PR, once the test has been added.

I can't seem to find a way to pass the store-dir explicitly on the command line, and --store-dir doesn't take any arguments:

./validate.sh -s cli-suite --pattern "PackageTests.Path.Compiler"
# cabal path
+ /home/sgillespie/dev/haskell/cabal/dist-newstyle-validate-ghc-9.10.1/build/x86_64-linux/ghc-9.10.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal path '-vverbose +markoutput +nowrap' -z --store-dir fake-dir --compiler-info
# <-- Snip -->
-----BEGIN CABAL OUTPUT-----
The 'path' command accepts no target arguments.
-----END CABAL OUTPUT-----

Is there something I'm missing here?

EDIT: Ignore this, I found it (cabalG ["--store-dir"] ...)

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

The GHC "Project Unit ID" store path has been used in cabal-install
since 3.12.1.0.

Resolves: haskell#10165
This change modifies the output of `cabal path`, and therefore requires
a changelog entry.
Update `compiler-project-unit-id` to `compiler-store-path` in the `cabal
path` output, as it is much more clear.
This adds a new test that verifies the output of `compiler-store-path`
when the store-dir is explicitly configured.
@sgillespie sgillespie force-pushed the feature/cmd-path-ghc-store branch from f8322e6 to b77ad81 Compare November 12, 2025 14:40
@sgillespie
Copy link
Collaborator Author

Thanks for the reviews! Am I good to add the "squash+merge me" label?

@fendor
Copy link
Collaborator

fendor commented Nov 13, 2025

I am not 100% sure about the label according to https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#github-pull-request-conventions, it should just be "merge me"?

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Nov 13, 2025

squash+merge looks more appropriate, thanks!

@fendor
Copy link
Collaborator

fendor commented Nov 13, 2025

Right, I should have fully read the docs :D

@sgillespie sgillespie added the squash+merge me Tell Mergify Bot to squash-merge label Nov 13, 2025
@mergify mergify bot added the ready and waiting Mergify is waiting out the cooldown period label Nov 13, 2025
@Mikolaj
Copy link
Member

Mikolaj commented Nov 14, 2025

Thank you for the PR. Do you need it in release 3.16?

@mergify mergify bot added merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days queued labels Nov 15, 2025
@mergify mergify bot merged commit f830ff4 into haskell:master Nov 15, 2025
197 of 206 checks passed
@mergify mergify bot removed the queued label Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days 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.

5 participants