-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ re #7173 ] Add the license information more in Paths_*pkgname* #7443
base: master
Are you sure you want to change the base?
[ re #7173 ] Add the license information more in Paths_*pkgname* #7443
Conversation
abb7727
to
1056324
Compare
Thank you for the PR. I've just read the issue and one question seems unanswered: what to do when there are multiple licenses. What's your preference there? |
EDIT: I'm sure someone would ask to be able to generate&include transitive dependency closure of a given library&executable, so maybe the design should be extended directly to cover that use case. The usefulness of & license (& text) of a single library is not IMHO motivated enough, that's quite static information - isn't it. OTOH, the dependency closure isn't so static nor easy to accumulate (there is |
Alright, thanks for your reply. I was not so sure how to do it, but I think I can do more than just giving file paths.
I will have
You are right. I forgot that I can simply fetch the license file during generating the module
The dependency graph will be available after |
1056324
to
0839b0c
Compare
@L-TChen What still needs to happen before this can be merged? |
Sorry for not getting back to you sooner. IIRC, this PR was for some discussion first to figure out the appropriate way to add license information to the module I plan to work on this PR this summer. |
I haven’t figured out how to get the text of the license file of every dependent package when generating the module My current understanding is that it might be worthwhile to keep the license file as a field of type Any hint? |
Not a great idea. My cabal store has 12000 packages currently. Reading its package database (i.e. 12000 If you need a file location(s), add a field for field locations. |
0839b0c
to
8d01287
Compare
I hit the issue #701. I am patching the record type IIUC, I will need to re-compile the |
8d01287
to
9964b51
Compare
I am trying to resolve #7173 by
embeddingadding the license information to the modulePaths_<pkgname>
.There are a few design issues I am not sure about.Should the license type be stored asString
or asLicense
type? In the current draft,license :: String
is pretty printed usingDistribution.Pretty
, i.e.Z.zLicense = show $ pretty $ license pkg_descr
inCabal/src/Distribution/Simple/Build/PathsModule.hs
. I don't know if there is any possible application requiringLicense
instead ofString
.Makinglicense
of typeLicense
means thatDistribution.License
needs to be imported and thusPaths_<pkgname>
depends on the packagecabal
. That is essentially the reason I am against usingLicense
.However, having a separate module likeLicense_<pkgname>
may alleviate the need for an extra dependency.Should it be a separate module instead? I plan to embed license files using Template Haskell, but I have the impression that invoking TH slows down the compilation in general.Update (Jun. 15):
Anything fancier than
String
results in an additional dependency anyway, includingtemplate-haskell
. I plan to add the following inPaths_<pkgname>
:license :: String
licenseFiles :: [FilePath]
where
license
andlicenseFiles
correspond to the fieldslicense
andlicense-file
in a.cabal
file. Since license files are not copied into the destination folder (please correct me if it is not the case), a sensible way to access its content is via Template Haskell to embed its content.Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!