MyNixOS website logo
Description

Alternative install procedure to avoid the diamond dependency issue.

Please see the README.md file on Github for more information: https://github.com/yesodweb/cabal-src/blob/master/README.md.

cabal-src is a package intended to help solve the Cabal diamond dependency problem.

The problem

Let's say you have three packages. foo depends on the text package, and can use any version of it. bar depends on text as well, but requires version 0.10.*. foobar depends on both of those.

If you upload these three packages to Hackage and install foobar, cabal will build foo and bar against the same version of text, and then build foobar against them. However, if you install these packages locally, foo will be built against the most recent version of text (currently 0.11.something), and then foobar will be unbuildable, since its dependencies depend on different versions of text.

You can see sample packages demonstrating the issue in the example folder.

This is just one example of the diamond dependency issue. When dealing with complicated systems such as Yesod, with dozens of packages that are in development, the situation becomes much worse.

Our solution

The important thing to note is that, if the packages are on Hackage, Cabal can handle the situation. The reason is that Cabal has enough information to calculate the correct versions of all dependencies to be used. So our goal is to give Cabal access to information on all dependencies, even those not yet on Hackage.

Instead of installing a local package with "cabal install", you can now use "cabal-src-install". This program actually calls out to "cabal install", and if that build succeeds, will perform the following steps:

  1. Create a source tarball via "cabal sdist"

  2. Copy this tarball into a special location in your .cabal folder.

  3. Update a 00-index.tar file specifically kept for cabal-src.

  4. Update your .cabal/config file to recognize the special cabal-src folder as necessary.

If you now install your "foo" and "bar" packages via "cabal-src-install", Cabal has full access to their source code. When it comes time to install foobar, Cabal can determine that foo can be recompiled with text 0.10 and will do so automatically.

Project status

This software should be considered alpha. We'll likely be using it for all Yesod development going forward, so I expect that alpha to be upgraded to beta and finally production quality in short order. All feedback is welcome!

Usage

Simply replace a call to "cabal install" with a call to "cabal-src-install". If you would like to only install the source tarball without actually installing the binary package, run it with "cabal-src-install --src-only".

mega-sdist

This package now also includes the mega-sdist util, which handles uploading to Hackage from mega repos.

Compares local code against version on Hackage. Accepts the following options:

  • --gittag: Automatically tag as well.
  • --test: Automatically run cabal tests

Uses sources.txt to determine which packages to build.

Metadata

Version

0.3.0.2

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows