Skip to content

Bundle Cabal and Cabal-syntax source with cabal-install? #9741

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

Open
mpickering opened this issue Feb 25, 2024 · 9 comments
Open

Bundle Cabal and Cabal-syntax source with cabal-install? #9741

mpickering opened this issue Feb 25, 2024 · 9 comments

Comments

@mpickering
Copy link
Collaborator

Perhaps we should bundle the latest Cabal and Cabal-syntax libraries with the cabal-install executable data files.

Then cabal-install can decide whether to build the latest Cabal library on the fly if the user's plan requires a `very new cabal version.

For example #9632 would benefit from this, if you use --multi-repl you get a constraint on a very new Caball library.

Some care would need to be taken to engineer things so that the new version is not picked as a matter of priority and only if explicitly needed.

My intuition is that if the packages were provided as a local+noindex repo then things would work out "just right".

I constructed an incomplete POC here (not currently using local+noindex): https://github.com/mpickering/cabal/tree/wip/bundle-cabal-package

Is this desirable to keep working on?

@michaelpj
Copy link
Collaborator

Adding a complicated and unprecedented (nobody else does something like this, right?) path that can only be triggered in unusual circumstances seems like a recipe for trouble, IMO.

@fgaz
Copy link
Member

fgaz commented Feb 26, 2024

To me it doesn't seem worth the trouble, since normal releases are not affected

@gbaz
Copy link
Collaborator

gbaz commented Feb 26, 2024

The issue only seems to arise when using pre-release versions of cabal, no? In such cases, I think its fine that they are not fully feature-complete until release, or that we require user making use of them require a custom repo.

I do think that a custom remote repo url for the bleeding edge of Cabal would be nice to provide, to facilitate pre-release testing, and this should be straightforward to add to existing github infrastructure?

We could then document this as a suggested cabal.project for people are testing pre-releases.

@andreabedini
Copy link
Collaborator

andreabedini commented Feb 27, 2024

👎 cabal-install already supports building a specific version of Cabal for a package custom-setup. Using source-repository-package to include Cabal's master is the correct solution I think.

edit: does source-repository-package add an available version or overrides the package? 🤔

@philderbeast
Copy link
Collaborator

edit: does source-repository-package add an available version or overrides the package? 🤔

I didn't check whether a source-repository-package could override a local package (I wouldn't expect it could) but I did check to see if a source-repository-package could refer to its own repository locally.

git diff
diff --git a/cabal.project b/cabal.project
index d506fe9b1..4773934a0 100644
--- a/cabal.project
+++ b/cabal.project
@@ -1,6 +1,11 @@
 import: cabal.project.latest-ghc
 
-packages: Cabal/
+source-repository-package
+  type: git
+  location: .
+  branch: master
+  subdir: Cabal
+
 packages: cabal-testsuite/
 packages: Cabal-syntax/
 packages: cabal-install/
$ cabal build all --dry-run
Warning: this is a debug build of cabal-install with assertions enabled.
fatal: repository '.' does not exist

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   cabal.project

@philderbeast
Copy link
Collaborator

philderbeast commented Feb 27, 2024

I tried a little harder with location to satisfy git;

  • location: file:///home/<username>/<some-path>/cabal/.git
$ cabal build all --dry-run
Warning: this is a debug build of cabal-install with assertions enabled.
Cloning into '/home/.../cabal/dist-newstyle/src/-f8fda6deb0823b0d'...
remote: Enumerating objects: 129882, done.
remote: Counting objects: 100% (129882/129882), done.
remote: Compressing objects: 100% (41924/41924), done.
remote: Total 129882 (delta 86260), reused 125375 (delta 82459), pack-reused 0
Receiving objects: 100% (129882/129882), 45.50 MiB | 65.07 MiB/s, done.
Resolving deltas: 100% (86260/86260), done.
HEAD is now at 9025af597 Merge pull request #9683 from mpickering/wip/package-db-fix
Resolving dependencies...
Build profile: -w ghc-9.8.2 -O1
In order, the following would be built (use -v for more details):
 - Cabal-3.10.2.1 (lib) (requires build)
...
  • location: file:///./.git
$ cabal build all --dry-run
Warning: this is a debug build of cabal-install with assertions enabled.
Cloning into '/home/philderbeast/dev/src/cabalism/cabal/dist-newstyle/src/-9789c1b843441545'...
fatal: '/./.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • location: file:///../cabal/.git
$ cabal build all --dry-run
Warning: this is a debug build of cabal-install with assertions enabled.
Cloning into '/home/philderbeast/dev/src/cabalism/cabal/dist-newstyle/src/-a64f0eadcf6723c2'...
fatal: '/../cabal/.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@andreabedini
Copy link
Collaborator

@philderbeast that's interesting but what is the problem you are trying to solve? Why using source-repository-package rather than packages? I think I miss some context.

@philderbeast
Copy link
Collaborator

philderbeast commented Feb 28, 2024

@andreabedini I don't have a problem with source-repository-package but your question (that I quoted) prompted me to try something to know if that was possible and to tread on the edge of what is possible.

@andreabedini
Copy link
Collaborator

@andreabedini I don't have a problem with source-repository-package but your question (that I quoted) prompted me to try something to know if that was possible and to tread on the edge of what is possible.

That quote was indeed the context I had missed <3 thank you

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

No branches or pull requests

6 participants