haskell / haskell/cabal

Implement support for PIP-style compat VCS URIs

Open
#5,522 7 comments 6 reactions 1 assignee Claimed by @typedrat View on GitHub
cabal-install: source-repository-package cabal-install: v2-build system type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

*This ticket quickly summarises a feature enhancement @typedrat and I discussed for the current GSOC*

Currently the VCS syntax in `cabal.project` files is rather clunky; but fortunately there's prior art we can steal from other ecosystems, specifically from [Python's PIP VCS Support](https://pip.readthedocs.io/en/latest/reference/pip_install/#vcs-support)

The goal is to have the more compact syntax (which must be valid [RFC 3986](https://tools.ietf.org/html/rfc3986)) as shown below in the non-exhaustive example

```
packages:
git+https://github.com/well-typed/cborg@3d274c14ca3077c3a081ba7ad57c5182da65c8c1#subdir=cborg
git+https://github.com/serokell/time-units.git@6c3747c1ac794f952de996dd7ba8a2f6d63bf132
```

be syntax sugar for the more verbose `source-repository-package` based specification

```
source-repository-package
type: git
location: https://github.com/well-typed/cborg
tag: 3d274c14ca3077c3a081ba7ad57c5182da65c8c1
subdir: cborg

source-repository-package
type: git
location: https://github.com/serokell/time-units.git
tag: 6c3747c1ac794f952de996dd7ba8a2f6d63bf132
```

NB: entries in `packages:` must be able to disambiguate the following 4 categories

- filepaths pointing to local package folders or `.cabal` files (e.g. `./mypkg/` or `/foo/bar/doo.cabal` or `./deps/*`)
- filepaths pointing to local package source-tarballs (e.g. `./deps/foo-1.2.3.tar.gz` or `deps/*.tar.gz`)
- remote HTTP(s) locations pointing to package source tarballs (e.g. `https://hackage.haskell.org/package/stm-2.5.0.0/candidate/stm-2.5.0.0.tar.gz`)
- URIs denoting remote VCS locations (i.e. this ticket's scope; this is easy to disambiguate because we require valid RFC3986 syntax; and the uri scheme always contains a token to indicate the VCS-type, e.g. `git`)

(fwiw, should the need arise that the local-filepath interpretation may not be properly detected, one could use explicit `file:///` uris to explicitly disambiguate and force interpretation as a local filepath)

This is a preliminary vague specifications; more details TBD

Follow-up stretch-goal: have `new-install` support vcs uris as well (TBD in separate ticket)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.