Coder Social home page Coder Social logo

stack2cabal's Introduction

Gitter Haskell CI Docker build Hackage version license

stack2cabal

This is forked of tseenshe/stack2cabal and the current hackage package.

Installation

Clone the repo and build with either cabal or stack or see the release page for binaries.

Docker

Docker pulls Docker stars Docker image size

docker pull hasufell/stack2cabal:latest

Usage

To convert a stack.yaml to cabal.project simply cd to the project directory and run:

stack2cabal

This will also create a cabal.project.freeze based on the stack resolver.

Also see stack2cabal --help for further options.

Docker

docker run --rm \
  -v /etc/passwd:/etc/passwd:ro \
  -u `id -u`:`id -g` \
  -v `pwd`:`pwd` \
  -w `pwd` \
  --tmpfs "$HOME/.cache" \
  hasufell/stack2cabal:latest

Notes

  • Hackage packages that are specified as git repositories in e.g. extra-deps might have a different version than the stack resolver. Therefore stack2cabal will download all repos and ignore their package names when generating cabal.project.freeze. This can take some time depending on your project. Pass --no-inspect-remotes to skip this.

stack2cabal's People

Contributors

fumieval avatar hasufell avatar hhefesto avatar maurges avatar philderbeast avatar rvem avatar symbiont-rahul-muttineni avatar tseenshe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

stack2cabal's Issues

extra-deps fields from stack.yaml overwrite resolver, possibly ingoring subdirs

Example https://github.com/input-output-hk/smash


resolver has:

- git: https://github.com/input-output-hk/ouroboros-network
  commit: f0eb6e439e7c0121476ded5e88d2f638e8aa36ac
  subdirs:
  - io-sim
  - io-sim-classes
  - network-mux
  - ntp-client
  - ouroboros-network
  - ouroboros-consensus
  - ouroboros-consensus-byron
  - ouroboros-consensus-cardano
  - ouroboros-consensus-shelley
  - typed-protocols
  - typed-protocols-examples
  - ouroboros-network-framework
  - Win32-network

stack.yaml has:

  # This is something extra we need.
  - git: https://github.com/input-output-hk/ouroboros-network
    commit: f0eb6e439e7c0121476ded5e88d2f638e8aa36ac
    subdirs:
    - cardano-client

cabal.project will only have:

source-repository-package
    type: git
    location: https://github.com/input-output-hk/ouroboros-network
    tag: f0eb6e439e7c0121476ded5e88d2f638e8aa36ac
    subdir: cardano-client

Support more pantry syntax

https://github.com/commercialhaskell/stack/blob/baa894b12b5b13330e340561cdd1040819498656/doc/pantry.md

- size: 285152
  subdir: wai
  url: http://github.com/yesodweb/wai/archive/2f8a8e1b771829f4a8a77c0111352ce45a14c30f.zip
  cabal-file:
    size: 1717
    sha256: 7b46e7a8b121d668351fa8a684810afadf58c39276125098485203ef274fd056

- size: 1442
  filepath: acme-missiles-0.3.tar.gz
  cabal-file:
    size: 613
    sha256: 2ba66a092a32593880a87fb00f3213762d7bca65a687d45965778deb8694c5d1
  name: acme-missiles
  version: '0.3'
  sha256: e563d8b524017a06b32768c4db8eff1f822f3fb22a90320b7e414402647b735b
  pantry-tree:
    size: 226
    sha256: 614bc0cca76937507ea0a5ccc17a504c997ce458d7f2f9e43b15a10c8eaeb033

- github: snoyberg/http-client
  commit: a5f4f30f01366738f913968163d856366d7e0342

Filter out extra-deps packages from freeze file.

As cabal constraints are additive, please filter from the generated freeze file any package names that are coming from git extra-deps. For instance, inclusion of any.prometheus ==2.2.3 in the following example will give a constraint solving error because bitnomial/prometheus:1fde661 is prometheus-2.2.2 and that is incompatible with the constraint prometheus ==2.2.3.

> cabal build all --enable-tests --minimize-conflict-set
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] next goal: prometheus (user goal)
[__0] rejecting: prometheus-2.2.3 (constraint from user target requires
==2.2.2)
[__0] rejecting: prometheus-2.2.2 (constraint from project config /.../cabal.project.freeze
requires ==2.2.3)
[__0] rejecting: prometheus-2.2.1, prometheus-2.1.3, prometheus-2.1.2,
prometheus-2.1.1, prometheus-2.1.0, prometheus-2.0.2, prometheus-2.0.1,
prometheus-2.0.0, prometheus-0.5.0, prometheus-0.4.2, prometheus-0.4.1,
prometheus-0.4.0, prometheus-0.3.2.1, prometheus-0.3.2, prometheus-0.3.1,
prometheus-0.3.0, prometheus-0.2.0, prometheus-0.1.1, prometheus-0.1.0.3,
prometheus-0.1.0.2, prometheus-0.1.0.1, prometheus-0.1.0.0 (constraint from
user target requires ==2.2.2)
[__0] fail (backjumping, conflict set: prometheus)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: prometheus
# stack.yaml
resolver: lts-18.27
...
extra-deps:
  - git: [email protected]:bitnomial/prometheus.git
    commit: 1fde661d897c500534769960584b29e8c39e8abb
# stack.yaml.lock
...
- completed:
    commit: 1fde661d897c500534769960584b29e8c39e8abb
    git: [email protected]:bitnomial/prometheus.git
    name: prometheus
    pantry-tree:
      sha256: 904843022ed0eabaf4e3dfc8f36e28e7365788c91e1d471b1eba56e1fca7511d
      size: 1969
    version: 2.2.2
...
-- cabal.project
-- Generated by stack2cabal

with-compiler: ghc-8.10.7
...
source-repository-package
    type: git
    location: [email protected]:bitnomial/prometheus.git
    tag: 1fde661d897c500534769960584b29e8c39e8abb
...
-- cabal.project.freeze
constraints:
             ...
             any.prometheus ==2.2.3,
             ...

'--help' argument won't show help

stack2cabal --help doesn't show help and tries to generate cabal files.

$ stack2cabal --help
stack2cabal: /tmp/stack.yaml: openBinaryFile: does not exist (No such file or directory)

Docs

image

Version

I installed stack2cabal with nix. The current version should be 1.0.11.

image

Windows support

It seems on windows it outputs windows path separators into cabal.project and friends...

Order of `source-repository-package`

Could we please have an option for source-repository-package order in the generated cabal.project? This would be either the order that they are found in stack.yaml or in alphabetical order.

Introspect hackage dependencies specified as git (e.g. in `extra-deps`)

Hackage packages that are specified as git repositories in e.g. extra-deps might
have a different version than the stack resolver. stack2cabal will still record the
version of the stack resolver in cabal.project.freeze. In order to fix that we have remove
the constraint of such dependencies entirely from the freeze file.

It would be nice if we could clone the repo, find the cabal file, check that it's part of hackage via cabal-install-parsers and then remove it from the freeze file output.

Still looking for `stack.yaml` with `--file` option.

If I use the --file option some part of stack2cabal still goes looking for a stack.yaml and finds there isn't one.

> stack2cabal --file=ghc-8.10.7.stack.yaml --output-file=ghc-8.10.7.project --no-inspect-remotes
stack2cabal: /.../stack.yaml: withBinaryFile: does not exist (No such file or directory)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.