Visitar URL original
Support non-Hackage dependencies · Issue #2189 · haskell/cabal · GitHub
Skip to content

Support non-Hackage dependencies #2189

Closed

Description

@23Skidoo

Summary by @ezyang:

  • Syntactic support for these URLs exists: in the packages field you can specify remote tarballs or local tarballs, and using the source-repository syntax (from Cabal file) you can point to a VCS URL (this parser should also have been reused for cabal.project)
  • Support for downloading from various places exists. There's support in the old-build path for local/remote tarballs. cabal get -s supports getting things from source repositories.
  • However, these are not used for anything: the internals need to be plumbed up to use this. Look at old stuff and determine how to port it over.

This should be doable in a day.


This came up on Twitter:

https://twitter.com/darinmorrison/status/527716059889954816

Basically, people want to publish packages that depend on stuff that is not on Hackage. One solution is to upload a forked package (example), but this has its own downsides (Hackage namespace becomes polluted). Implementing something like build-depends: https://repo.git@revision would be a nice alternative. Most other package managers (e.g. sbt) support this.

It should also be possible to prohibit downloading packages not on Hackage via a config file option.

See also #1534.

Activity

  1. self-assigned this
    on Oct 31, 2014
  2. mietek commented on Nov 11, 2014

    @mietek
    Contributor

    Halcyon supports declaring sandbox sources with the HALCYON_SANDBOX_SOURCES option.

    See Try Haskell for an example of declaring the git HEAD version of mueval as a sandbox source.

  3. added this to the milestone on Apr 24, 2015
  4. winterland1989 commented on Jul 11, 2016

    @winterland1989

    I'd like to bump this issue's priority and start to discuss implementation, currently it's stopping us using cabal in company environment because we have multiple packages can't be upload to hackage, and a hackage mirror is an overkill. now we use stack to solve this headache, but it's really not necessary to rely both on hackage and stackage infrastructure.

  5. ezyang commented on Jul 11, 2016

    @ezyang
    Contributor

    Hello @winterland1989. Have you tried the new new-build functionality (http://blog.ezyang.com/2016/05/announcing-cabal-new-build-nix-style-local-builds/). If you have all of the non-Hackagable packages on disk in a build tree, you can write a cabal.project to pick them up, and then cabal new-build will automatically build them together. Does that solve your proximal problem?

  6. winterland1989 commented on Jul 11, 2016

    @winterland1989

    Thanks for your reply @ezyang ! I'm aware that there're multiple ways solving local package discovery: cabal sandbox add-source or a cabal.project file both solve this, and i'm aware that cabal.project file support parsing URI as package now. But we need an automatic way to pull/update the remote file into disk without hassle, currently available options are git submodule, hand-role shell and stack.(you really want to automate this process when you got more than 5 local depends).

    If cabal.project file is the final solution, i'll dig into it to see what i can do.

  7. 23Skidoo commented on Jul 11, 2016

    @23Skidoo
    MemberAuthor

    @winterland1989
    There is already some code for declaring VCS dependencies in cabal.project files: https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/ProjectConfig.hs#L523

    If you want to contribute code to Cabal, I suggest improving the nix-local-build code path, since the plan is to make it the default in the future.

  8. alanz commented on Jul 11, 2016

    @alanz
    Collaborator
  9. phadej commented on Jul 13, 2016

    @phadej
    Collaborator

    Looks like we only need to teach cabal-install how to fetch stuff from the internet:

    fail $ "TODO: add support for fetching and reading local tarballs, remote "

    tar support shouldn't be difficult, as cabal handles it already. git is trickier, as we need to teach cabal-install to call git clone (and darcs).

    Question: were to put downloaded stuff, dist-newstyle/downloaded/hash-of-the-source ?

  10. phadej commented on Jul 13, 2016

    @phadej
    Collaborator

    (For now one can use git submodule, effectively the result should be the same)

  11. added
    cabal-install: v2-build systemAffecting v2-build and related commands that use v2-architecture (aka "nix local builds").
    on Jul 13, 2016
  12. alanz commented on Jul 13, 2016

    @alanz
    Collaborator
  13. winterland1989 commented on Jul 13, 2016

    @winterland1989

    FYI, every github commit can be downloaded as a zip file, e.g.

    Yes, but that's github's convention, we probably shouldn't rely on that convention. In fact we can safely assume user have git binary installed if they want to use git depends, and we can use process package manage git clone/pull.

  14. alanz commented on Jul 13, 2016

    @alanz
    Collaborator

    A use case for this is during development when another client component has not yet been released to hackage. E.g. ghc-mod for HaRe. This is a temporary state.

    Having a temporary config in a cabal.project is a lot more lightweight than adding a git submodule.

  15. 7 remaining items

  16. 23Skidoo commented on Sep 8, 2016

    @23Skidoo
    MemberAuthor

    If we allow fiddling then it has to be treated like a local dir.

    We can ask git if the source has been fiddled with and then fall back to treating it like a local dir if it is the case.

  17. modified the milestones: , ⊥ on Sep 8, 2016
  18. ezyang commented on Sep 8, 2016

    @ezyang
    Contributor

    I'm inclined to just not allow specification of a hash if you don't specify a remote URL. Don't really want new-build to be checking out git branches or ignoring my hash...

  19. bitemyapp commented on Oct 28, 2016

    @bitemyapp
    Contributor

    I'm looking forward to celebrating this issue's second 🎂 in two days.

  20. bitemyapp commented on Oct 30, 2017

    @bitemyapp
    Contributor

    screenshot from 2017-10-30 11-14-13
    screenshot from 2017-10-30 11-14-21

    Happy 🎂!

  21. gbaz commented on Mar 24, 2018

    @gbaz
    Collaborator

    The provenance-qualified imports proposal (ghc-proposals/ghc-proposals#115) is relevant here.

  22. hvr commented on Jul 14, 2018

    @hvr
    Member

    It's a pity @bitemyapp won't get to celebrate schadenfreude this year... ;-)

  23. typedrat commented on Jul 15, 2018

    @typedrat
    Collaborator

    Closed by #5351.

  24. nomeata commented on Jul 18, 2018

    @nomeata
    Contributor

    Exciting! I want to play with this

    But is this really fixed? https://github.com/haskell/cabal/blob/master/Cabal/doc/nix-local-build.rst on master still says

    
        3. [STRIKEOUT:They can specify an ``http``, ``https`` or ``file``
           URL, representing the path to a remote tarball to be downloaded
           and built.] (not implemented yet)
    

    and

    [STRIKEOUT:There is also a stanza source-repository-package for specifying packages from an external version control.] (Not implemented.)
    
  25. typedrat commented on Jul 18, 2018

    @typedrat
    Collaborator

    That's a documentation bug, I believe.

  26. nomeata commented on Jul 18, 2018

    @nomeata
    Contributor

    I will know in a few minutes when cabal has built and I can try the feature :-)
    …
    Yes, seems to work. Great!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions