GithubHelp home page GithubHelp logo

haskell-hvr / cabal-plan Goto Github PK

View Code? Open in Web Editor NEW
37.0 9.0 24.0 299 KB

Library and utility for processing cabal's plan.json file

Home Page: https://hackage.haskell.org/package/cabal-plan

License: GNU General Public License v2.0

Haskell 72.81% CSS 3.22% HTML 22.02% Makefile 1.25% Shell 0.70%
cabal haskell

cabal-plan's Introduction

cabal-plan: Library and utility for processing cabal's plan.json file Hackage Build Status

Please refer to the package description for an overview of cabal-plan.

cabal-plan's People

Contributors

andys8 avatar bgamari avatar danielg avatar hasufell avatar hvr avatar lukel97 avatar merijn avatar mitchellwrosen avatar peti avatar phadej avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cabal-plan's Issues

license-report crashes for array-0.5.3.0 with "user error"

cabal-plan crashes in the middle of reporting my transitive dependencies with:

cabal-plan: user error (Unit {uId = UnitId "array-0.5.3.0", uPId = PkgId (PkgName "array") (Ver [0,5,3,0]), uType = UnitTypeBuiltin, uSha256 = Nothing, uComps = fromList [(CompNameLib,CompInfo {ciLibDeps = fromList [UnitId "base-4.12.0.0"], ciExeDeps = fromList [], ciBinFile = Nothing})], uFlags = fromList [], uDistDir = Nothing})

Profiling suggest that the crashing line is

| otherwise -> fail (show u)

$ cabal-plan --version
cabal-plan 0.4.0.0
$ cabal --version
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library
$ cabal new-exec -- ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.2
$ ls -l ~/.cabal/packages/hackage.haskell.org/01-index.tar
.rw-r--r-- 554M --- 16 Nov  8:21 /home/---/.cabal/packages/hackage.haskell.org/01-index.tar

Add support for new `file+noindex://` style repos

This looks like

      "pkg-src": {
        "type": "repo-tar",
        "repo": {
          "type": "local-repo-no-index",
          "path": "vendored/"
        }
      },

and will currently trigger a parsing failure

cabal-plan: user error (Error in $['install-plan'][1]['pkg-src'].repo: invalid Repo "type")

It's trivial to fix... just filing this issue as a TODO

Binary distribution for CI

I use the make-travis-yml to generate .travis.yml and I'd like to use cabal-plan list-bin to get the path to the final executable for deployment. Is there any plan to provide binary distribution of cabal-plan, or probably migrate this command into cabal-install?

You asked to install executables, but there are no executables in target: cabal-plan.

Hi! After the 0.7 update I'm getting:

Installing library in /home/travis/.cabal/store/ghc-8.2.2/incoming/new-7485/home/travis/.cabal/store/ghc-8.2.2/aeson-1.5.1.0-6a0a95190144ea25bf638a1a4453f043656f0c1d0e1ad60d05ecb479b720e4cd/lib

Configuring library for cabal-plan-0.7.0.0..

Preprocessing library for cabal-plan-0.7.0.0..

Building library for cabal-plan-0.7.0.0..

[1 of 1] Compiling Cabal.Plan ( src/Cabal/Plan.hs, dist/build/Cabal/Plan.o )

Installing library in /home/travis/.cabal/store/ghc-8.2.2/incoming/new-7485/home/travis/.cabal/store/ghc-8.2.2/cabal-plan-0.7.0.0-74b1b9f71f8b69558f21ca9bcde695c1813ec431eaf9f5f9f6dd216aac0b1026/lib

Warning: You asked to install executables, but there are no executables in target: cabal-plan. Perhaps you want to use --lib to install libraries instead.

And similarly for many other setups:

https://travis-ci.org/github/AllureOfTheStars/Allure/builds/691207997

cannot compile with `-haddock` with ghc-8.10

I have ghc-options: -haddock in my (global) cabal config. With ghc-8.10.7, this happens:

cabal install cabal-plan
...
[6 of 6] Compiling Main             ( src-exe/cabal-plan.hs, dist/build/cabal-plan/cabal-plan-tmp/Main.o )

src-exe/cabal-plan.hs:155:5: error:
    parse error on input ‘-- $ cabal-plan list-bin cab<TAB>’
    |
155 |     -- $ cabal-plan list-bin cab<TAB>
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build exe:cabal-plan from cabal-plan-0.7.2.1. See the build
log above for details.

The fix is trivial (I can send patch). Perhaps it's not even needed, since it's fine with ghc-9.

License report not working (broken macro condition)

The latest version 0.7.2.2 seems to have the license report broken.

Cabal was replaced by Cabal-syntax.

9f8f3f4#diff-23e8e99cc253e60e2a102314196134f5c41bb53f9da01124018798e371228bb5R130

But there are macros checking for the minimum - and if defined at all - Cabal version:

#if defined(MIN_VERSION_Cabal)

These are always wrong and we run into this error all the time.

hPutStrLn stderr "ERROR: `cabal-plan license-report` sub-command not available! Please recompile/reinstall `cabal-plan` with the `license-report` Cabal flag activated."

cabal-plan-0.6.2.0 : please revise bounds to allow these-1.1

There is a revision on cabal-plan-0.7.0.0 to extend the acceptable range for these to be

, these          ^>= 1 || ^>=1.1

Please apply this to version 0.6.2.0 too.

Context: the build using cabal of cabal-plan-0.6.2.0 uses these-1.1, but stack complains. Trying to bump resolvers for haskell-ide-engine.

topograph not in Hackage

I am probably missing something but topograph is not in Hackage.
So one is not meant to cabal install topograph?
I was trying to build cabal-helper (which now needs cabal-plan) for Fedora...

"WARNING: couldn't find metadata for <pkg>" when using "license-report" command

I'm trying out cabal-plan's license-report command and I happened to notice this in the output:

WARNING: couldn't find metadata for mattermost-api-50200.14.0

The mattermost-api package is a direct dependency of the executable on which I am running license-report. Its source is located in a Git submodule of my source tree and the package is listed in cabal.project. Is there any way that I can ensure that cabal-plan will also include mattermost-api and its transitive dependencies in its license-report output?

Thanks!

(CC matterhorn-chat/matterhorn#740)

[Feature Request] Add why-depends command

Similar to nix, add why-depends command, to show why you depend on a package.

Workflow:

$ cabal-plan why-depends exe:foo containers
 └─ foo-1.0
    [foo-1.0:exe:"foo"]
    └─ some-package-2.7.1
       └─ containers-0.6.2.1 ┄┄

If package is multiple times in the dependency closure, every path is shown.

An extension would be to show why this version was chosen.
Some idea for the output format:

$ cabal-plan why-depends exe:foo containers --show-constraints
some-package: containers ^>= 0.6.2.1

Final version constraint:
containers ^>= 0.6.2.1

Chose containers-0.6.2.1

If this feature is a welcome addition to cabal-plan, I would be happy to provide a PR for it.

Support XDG cabal config location

$ cabal-plan license-report mypackage
cabal-plan: /home/fgaz/.cabal/config: withBinaryFile: does not exist (No such file or directory

Garbled output of `Top-sorted` list of all dependencies (macOS)

I would like to use cabal-plan to generate a extra-deps in a stack.yaml file automatically, using the list of all dependencies under Top-sorted:

$ cabal-plan
...
Tree
~~~~

fix-whitespace-0.0.8
 [fix-whitespace-0.0.8:exe:"fix-whitespace"]
 ├─ base-4.16.0.0
...
Top-sorted
~~~~~~~~~~

UnitId "rts-1.0.2"
UnitId "ghc-prim-0.8.0"
UnitId "ghc-bignum-1.2"
UnitId "base-4.16.0.0"
UnitId "ghc-boot-th-9.2.1"
UnitId "array-0.5.4.0"
UnitId "deepseq-1.4.6.0"
UnitId "pretty-1.1.3.6"
UnitId "template-haskell-2.18.0.0"
UnitId "OnTpl-0.3.1-67092f35"
UnitId "stm-2.5.0.0"
UnitId "transformers-0.5.6.2"
UnitId "SttVr-1.2.2-18f5a458"
UnitId "bs-rphns-0.8.6-c90f3464"
UnitId "containers-0.6.5.1"
UnitId "tggd-0.8.6.1-23ebf165"
UnitId "dstrbtv-0.6.2.1-30d16c25"
UnitId "ndxd-trvrsbl-0.1.2-ea4c6a7b"
UnitId "trnsfrmrs-cmpt-0.7.1-11824f21"
UnitId "cmnd-5.0.8-f7847f23"
UnitId "th-bstrctn-0.4.3.0-331f74f3"
UnitId "bfnctrs-5.5.11-dfa607d8"
UnitId "bytestring-0.11.1.0"
UnitId "binary-0.8.9.0"
UnitId "time-1.11.1.1"
UnitId "unix-2.7.2.2"
UnitId "bs-cmpt-0.12.1-5d888bd5"
UnitId "bs-cmpt-bttrs-0.12.1-e85719a6"
UnitId "clck-0.8.2-49217a3c"
UnitId "filepath-1.4.2.1"
UnitId "directory-1.3.6.2"
UnitId "mtl-2.2.2"
UnitId "exceptions-0.10.4"
UnitId "text-1.2.5.0"
UnitId "hshbl-1.4.0.0-31d6e39d"
UnitId "nrdrd-cntnrs-0.2.15.0-08f1410e"
UnitId "splt-0.2.3.4-8fd6a6a9"
UnitId "prmtv-0.7.3.0-2eb0ce6a"
UnitId "vctr-0.12.3.1-ac51a413"
UnitId "vctr-lgrthms-0.8.0.4-119c737a"
UnitId "mn-trvrsbl-1.0.15.3-e9676e28"
UnitId "nlft-cr-0.2.0.1-9bdb8a14"
UnitId "rsrct-1.2.4.3-7795e470"
UnitId "cndt-1.3.4.2-cec99d9e"
UnitId "cntrvrnt-1.5.5-73ae429b"
UnitId "spltmx-0.1.0.4-d627621d"
UnitId "rndm-1.2.1-8175b129"
UnitId "d-typs-1.0.5-dd6298b2"
UnitId "dlst-1.0-db9e945a"
UnitId "dt-fx-0.3.2-cbb975f2"
UnitId "process-1.6.13.2"
UnitId "xtr-1.7.10-74cdb974"
UnitId "flpttrn-0.1.2-3d850001"
UnitId "lbyml-0.1.2-5d834e71"
UnitId "ntgr-lgrthms-1.0.3.1-38e2483a"
UnitId "scntfc-0.3.7.0-059148ff"
UnitId "ndxd-trvrsbl-nstncs-0.1.1-4659c8bc"
UnitId "smgrpds-5.3.6-bba6bb6b"
UnitId "ssc-1.0.2-267c64ef"
UnitId "ths-1.1.1.1-cb98139d"
UnitId "smlgn-1.2.0.1-0b87c17e"
UnitId "strct-0.4.0.1-cbf6f9b8"
UnitId "tm-cmpt-1.9.6.1-1c51abdb"
UnitId "ttprsc-0.14.2-0139c7c8"
UnitId "txt-shrt-0.1.4-885370e8"
UnitId "wthrbl-0.4.2-afa8ff09"
UnitId "sn-2.0.2.0-1cf37732"
UnitId "yml-0.11.7.0-55eff270"
UnitId "fix-whitespace-0.0.8-inplace-fix-whitespace"

Direct deps
~~~~~~~~~~~

PkgId (PkgName "fix-whitespace") (Ver [0,0,8])
CompNameExe "fix-whitespace"
  base-4.16.0.0
  directory-1.3.6.2
  filepath-1.4.2.1
  filepattern-0.1.2
...

Unfortunately, the list of all packages gives garbled names (on macOS) for all non-core packages, due to

A better access to the package names and version is provided by

$ cabal-plan fingerprint 
98853682d52fb4cc37a45cd186fbd77cf2565d3df5171acc4cf026427e103eef G OneTuple-0.3.1
5e4b39da395656a59827b0280508aafdc70335798b50e5d6fd52596026251825 G StateVar-1.2.2
d5ca55dd7fab55d3a0e166f04d14d1361696077b664b58b42e2523a160208037 G aeson-2.0.2.0
________________________________________________________________ B array-0.5.4.0
...

Thus, this issue is maybe more a wart than a real problem and can wait for an upstream fix.

Support for ghc-8.10.1

  • We are adding adding support in hie for ghc-8.10.1
  • hiedepends on this package via cabal-helper
  • The package has an upper bound over base (^>=4.13) (or it has not ^>4.14) that makes it incompatible with the version installed with ghc-8.10.1
PS D:\dev\ws\haskell> cabal update
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
    cabal v2-update 'hackage.haskell.org,2020-04-07T05:55:26Z'
PS D:\dev\ws\haskell> cabal v2-install cabal-plan-0.6.2.0 --lib -w ghc-8.10.1 
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: cabal-plan-0.6.2.0 (user goal)
[__1] next goal: base (dependency of cabal-plan)
[__1] rejecting: base-4.14.0.0/installed-4.14.0.0 (conflict: cabal-plan =>
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: base, cabal-plan)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, cabal-plan

PS D:\dev\ws\haskell> cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library
  • cabal v2-install cabal-plan-0.6.2.0 --lib -w ghc-8.10.1 --allow-newer=cabal-plan:base seems to work

Thanks in advance!

Bad error message `No hackage.haskell.org repository` for legacy `remote-repo` entry in the cabal configuration

It would be good if the help texts contained some example uses.
I fail to discover how to invoke cabal-plan to get my license report.

This is what I tried:

$ cabal install -f license-report cabal-plan
...

$ cabal-plan --version
cabal-plan 0.7.2.0

$ cabal-plan license-report --help
Usage: cabal-plan license-report [--licensedir DIR] PATTERN
  Generate license report for a component

Available options:
  --licensedir DIR         Write per-package license documents to folder
  PATTERN                  Pattern to match.
  -h,--help                Show this help text

$ cabal-plan license-report Agda:exe:agda
cabal-plan: user error (No hackage.haskell.org repository)

$ ping hackage.haskell.org
PING ...: 56 data bytes
64 bytes from ... icmp_seq=0 ttl=60 time=15.678 ms

In particular, I do not understand the error No hackage.haskell.org repository and how to address it.

Feature request: emit license-report as JSON

For further processing, e.g., fetching all the license texts to build a license.txt file, it would be great if cabal-plan could emit the license-report as JSON.

Would it be possible to add a --json flag to the license-report subcommand?

I assume the implementation effort would be minimal, since we can presumable just convert the data structure used by the license report to json, rather than printing it as Markdown?

Level of testing, preferred libraries?

Would you rather have more unit or integration tests?
If unit tests, what is your preferred library or framework?

I know this is a small program, that hardly needs tests. I just find it interesting and want to be able to refactor quickly if I contribute more.

Support an ascii mode for output

cabal-plan currently uses unicode to drw output but Unicode on WIndows is broken till GHC 9.0 ships.

So cabal-plan crashes with

using 'C:\Users\xbox\Documents\latex\lhs2tex-1.24' as project root

Tree
~~~~

lhs2tex-1.24
 [lhs2tex-1.24:exe:"lhs2TeX"]
 ├─ base-4.14.1.0
 │  ├─ ghc-prim-0.6.1
 │  │  └─ rts-1.0
 │  ├─ integer-gmp-1.0.3.0
 │  │  └─ ghc-prim-0.6.1 cabal-plan.exe: <stdout>: commitAndReleaseBuffer: invalid argument (invalid character)

now setting the code-page to utf-8 explicitly gets around that

but because of APIs being used on a native Windows console all you see is garbage

lhs2tex-1.24
 [lhs2tex-1.24:exe:"lhs2TeX"]
 Γö£ΓöÇ base-4.14.1.0
 Γöé  Γö£ΓöÇ ghc-prim-0.6.1
 Γöé  Γöé  ΓööΓöÇ rts-1.0
 Γöé  Γö£ΓöÇ integer-gmp-1.0.3.0
 Γöé  Γöé  ΓööΓöÇ ghc-prim-0.6.1 ΓöäΓöä
 Γöé  ΓööΓöÇ rts-1.0 ΓöäΓöä
 Γö£ΓöÇ directory-1.3.6.0
 Γöé  Γö£ΓöÇ Win32-2.6.1.0
 Γöé  Γöé  Γö£ΓöÇ base-4.14.1.0 ΓöäΓöä
 Γöé  Γöé  Γö£ΓöÇ bytestring-0.10.10.0

having an --ascii flag would be very helpful till winio.

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.