Closed
Milestone
Description
(Imported from Trac #889, reported by joeyadams on 2011-09-27)
It should be possible to list all of the dependencies of a package, including their licenses. This would be useful for:
- Developers writing proprietary applications.
- Developers who don't want their liberally-licensed libraries to be "upgraded" to the GPL or similar by subtle dependencies.
$ cabal install --verbose=2 --dry-run gnutls
Reading available packages...
Resolving dependencies...
base BSD3
bytestring BSD3
ffi BSD3
ghc-prim BSD3
gnutls GPL (Just (Version {versionBranch = [3], versionTags = []}))
integer-gmp BSD3
monads-tf BSD3
rts BSD3
transformers BSD3
In order, the following would be installed:
monads-tf-0.1.0.0 (new package)
gnutls-0.1 (new package)
This is a quick hack, as I am not familiar with the Cabal codebase. This should probably be wrapped as a --list-licenses command line switch. Pretty-printing licenses would be a plus.
I am already finding this feature useful, and hope others will too.
Reacted by Harendra Kumar and Connor Clark
Activity
bos commentedon May 24, 2012
(Imported comment by @kosmikus on 2011-09-27)
Vaguely related to #539. (Both are about getting more info about the overall dependency graph, but admittedly in quite different ways.)
ivanperez-keera commentedon Sep 29, 2013
I would find this useful to list all the dependencies of a project when I need to reinstall them (for instance, with --enable-library-profiling).
I suggest that this behaviour be included with 'list-dependencies' (either as a command or a flag of some other command), and that licenses be printed only when --verbose is used.
tibbe commentedon Sep 29, 2013
@ivanperez-keera We're solving the freezing of dependencies another way, namely using #1519
mtullsen commentedon Nov 20, 2014
This (the "along with their licenses" part) is something that Galois is very interested in. On one of our projects we are delivering a binary to a customer and we want some confidence regarding the license(s) for that binary.
What we currently have is highly ad hoc:
We basically want a way to list the package dependencies and their licenses. Here's some ideas as to a more principled way to add this capability:
How to invoke the feature:
Alternative 1: add options to the cabal list command:
(In the latter case we need
--show-licensesbecause--simple-outputdoesn't print the license information.)Alternative 2: a new cabal command that works similar to 'cabal list':
Also, we might generalize
--showlicensesto an ability to display the value of any cabal field:What seem to be less desirable approaches:
As an option to install: we'd like to extract this information after installation without having to re-install.
Using the by-products of
cabal freeze: I see that I can get the list of dependencies frombut I'd much prefer to not be parsing the by-product of another command.
Yet another need we have:
--show-fieldoption, but I'm not sure how we'd get the information where the license files are stored.Galois is interested in doing the development needed. But before we start, we'd like to get some consensus on what the community is interested in (and what patches would be likely to be accepted :-).
Input? Wishes? Other thoughts?
Thanks, Mark
23Skidoo commentedon Nov 20, 2014
@mtullsen
Great! You may be interested in https://github.com/jaspervdj/cabal-dependency-licenses which also implements this functionality.
I'm +1 on this alternative.
The licenses are stored under
~/.cabal/share/doc/$arch-$os-$compiler/$pkgid(akaInstallDirs.docdir), so if you know the target platform and have a package description of the dependency in question (which tells you the value oflicense-file), retrieving them is easy. Note that there can be multiple license files per package. Also note that with GHC 7.10,$pkgidalso includes the package key in addition to package name and version. Maybe we could add a flag tocabal copyto do what you want.23Skidoo commentedon Nov 20, 2014
/cc @dcoutts
mtullsen commentedon Nov 20, 2014
Thanks for the pointer, I was completely unaware of this.
We'd still be interested in bringing this functionality into cabal-install. I'm assuming that others would also find this useful ...?
mietek commentedon Nov 27, 2014
In a similar vein, I would like to be able to list the
build-toolsandextra-libsused by a project's transitive dependencies. I have done some work towards this, but it is not quite satisfactory (mietek/haskell-on-heroku#34).dcoutts commentedon Nov 27, 2014
People have looked before at the feature to collect the bundle of licenses for a package (in a particular configuration). Would that be enough and cover the other use cases or do we need it in multiple places?
Extend the cabal 'list' command with --dependencies
libeako commentedon Oct 12, 2017
I was about to request this feature.
Many common licenses require a reproduction of the license when the software is distributed in binary form. For example : BSD3 :
"Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution."
It is too tedious and error-prone to manually traverse the dependency graph and the individual licenses.
I imagine a command line tool that collects the license info into a folder dedicated for this purpose, which would be distributed together with the executable.
hvr commentedon Oct 13, 2017
fwiw, @ekmett mentioned on
#hackagehe hacked up a script which generatesoutput like https://gist.github.com/ekmett/34024e26479763d77bc3e1ecaa24b819
Profpatsch commentedon Nov 24, 2017
A command line feature like this would be awesome, to see which package introduced which dependencies. For reference, here’s how
nix-store 1.11implements it (though I’m not a fan of the naming at all).Interesting is the distinction between run-time and build-time dependencies, though I’m not sure if that’s relevant for cabal.
neosimsim commentedon Oct 25, 2019
Might be relevant/interesting for custom setups.
andreasabel commentedon Aug 25, 2021
https://github.com/hvr/cabal-plan seems to solve the OP, see https://hackage.haskell.org/package/cabal-plan
Here is how we use it in Agda:
https://github.com/agda/agda/blob/2bab72d99ae3330cbf3a94450a647158838a1d1b/doc/license-report/Makefile#L9-L20
Mikolaj commentedon Aug 27, 2021
Given that the original ticket is from 2011 and @andreasabel's solution seems plausible, I'm closing this. Please reopen if the solution does not work for you, with details what's missing, or open a new ticket about the missing parts. #4887 remains open for now.
ethercrow commentedon Nov 24, 2021
Posting just in case someone would have the same problem.
cabal install -f license-report cabal-planwas failing for me, claiming that it's not buildable.However,
cabal install -f exe -f license-report cabal-planseems to work.andreasabel commentedon Nov 25, 2021
@ethercrow :
I stumbled over this myself: Here is some justification for the current flag setup by the author: #7814 (comment)