Skip to content

cabal sdist: Rename Cabal file to match the package name #10947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmhat
Copy link

@mmhat mmhat commented May 6, 2025

This PR modifies how source distribution are packaged by cabal-install:exe:cabal:

Before, if the name of the Cabal file did not match the actual package name, then cabal sdist would include the Cabal file as-is in the source distribution, causing a subsequent cabal check to issue a warning and the failure of a Hackage upload.

This commit changes that behaviour: The name of the Cabal file in the source distribution always matches the package name, regardless what it was named in the filesystem.

EDIT:
Related issue: #6299
Fixes #7322


@ulysses4ever
Copy link
Collaborator

ulysses4ever commented May 6, 2025

It feels to me like it can break someone's workflows, i.e. people may assume that the name of the cabal file does not magically change --- a very reasonable expectation! Maybe the new behaviour could be enabled by a flag?.. In any case, there should be an issue with the discussion of the design before a PR, see https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#pull-requests--issues

@geekosaur
Copy link
Collaborator

If Hackage is currently rejecting such packages, it's probably not breaking many workflows.

@mmhat
Copy link
Author

mmhat commented May 6, 2025

First, thanks for your feedback @ulysses4ever @geekosaur !

It feels to me like it can break someone's workflows, i.e. people may assume that the name of the cabal file does not magically change --- a very reasonable expectation! Maybe the new behaviour could be enabled by a flag?

I see your concerns, and I am not sure about that myself; That's why this is a draft PR.
However, I agree with @geekosaur that there are probably not that many workflows (if any) this would break, but not renaming the Cabal file caused already issues; See #7322.

In any case, there should be an issue with the discussion of the design before a PR, see https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#pull-requests--issues

I am aware of the guide lines, but I also forgot to link two related issues #6299 and the aforementioned #7322 in the description of the PR; Sorry for that.
Do you think one of these issues is sufficient or should I open a separate one?

BTW: The PR template proposed to me referred to contribution guidelines found in cabalism/cabal -- Is this intended?

Before, if the name of the Cabal file did not match the acutual package
name, then `cabal sdist` would include the Cabal file as-is in the
source distribution, causing a subsequent `cabal check` to issue a
warning and the failure of a Hackage upload.

This commit changes that behaviour: The name of the Cabal file in the
source distribution always matches the package name, regardless what it
was named in the filesystem.

Related issue: haskell#6299
mbWorkDir <- Just . makeSymbolicPath <$> canonicalizePath dir
cabalFilePath <-
getSymbolicPath
<$> tryFindPackageDesc verbosity mbWorkDir
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could probably pass in the location, since you must have already read the cabal file, but I do see that listPackageSources does also call tryFindPackageDesc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cabal install prints unhelpful error when .cabal filename does not match the package name
4 participants