Skip to content
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

Fix #701: Add licenseFiles to InstalledPackageInfo #9172

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

L-TChen
Copy link

@L-TChen L-TChen commented Aug 14, 2023

This PR address the issue #701 and #9184. A field licenseFile (singular) should have been there in InstalledPackageInfo, IPI for short) as described in Section 5.9.9 the GHC documentation, but it is not.

Thus, this PR adds a field license-files for multiple license files and changes the pretty printer of PackageDescription to print the field license-files which was previously hidden.

Rationale:
cabal has supported the field licenseFiles for multiple license files and some packages have adopted this form, so it makes sense to support licenseFiles in IPI as well. Considering that IPI has not yet supported the singular form of licenseFiles (i.e. no backward compatibility is needed), I suggest only the field name license-files should be used to simplify pretty printer and parsing.


Template Α: This PR modifies cabal behaviour

Include the following checklist in your PR:

Bonus points for added automated tests!

@andreabedini
Copy link
Collaborator

Related discussion #8967

@L-TChen
Copy link
Author

L-TChen commented Aug 30, 2023

Is there anything that needs to be done to get this PR reviewed or merged? 😅

@andreabedini
Copy link
Collaborator

@L-TChen I am very sorry for the lack of feedback. Personally speaking, the direction I would like to see is reducing (not increasing) the amount of information in the packagedb. GHC is not going to do anything with the licence field, neither is cabal. This is what I was arguing in the linked issue.

I feel we haven't yet reached consensus though so that is why I hesitated giving you feedback based on my own opinion.

So maybe we can make progress by understanding what prompted you to propose this change. Of the two issues you link, one I reckon is mostly an historycal discussion (I added the "consider closing" label).

The other (that you opened) is a clear bug with a clear simple solution which you have correctly indentified; as far as I understand (please correct me) the fix to this issue does not require changing IPI.

Again with apologies, would you consider limiting the scope of this PR to only fixing #9184? (or opening a separate one if so you prefer).

Let me know if I am missing something more fundamental.

@L-TChen
Copy link
Author

L-TChen commented Aug 31, 2023

Thanks for getting back to me!

  1. I was trying to fix Feature request: provide text of LICENSE file as String/Text in generated Paths_XYZ #7173 and then found Track license-file in ghc package database. #701. If Track license-file in ghc package database. #701 is fixed by adding the locations of license files to the package DB, then Feature request: provide text of LICENSE file as String/Text in generated Paths_XYZ #7173 can be easily achieved. Since GHC has listed licenseFile as a field in IPI already, I viewed this PR as a bug fix, independent of Feature request: provide text of LICENSE file as String/Text in generated Paths_XYZ #7173.

  2. Also considering Please add --licensedir flag to cabal-install #5281, calculating their locations based on the path of docdir is not forward-compatible, so their locations need to be stored somewhere. If Please add --licensedir flag to cabal-install #5281 is to be resolved, I think this field licenseFiles and perhaps an additional licenseDir are needed anyway.

  3. Finally, I understand the license files are not needed for GHC or cabal to build, but IMHO Track license-file in ghc package database. #701 should be resolved because of
    the following clause in many open-source licenses:

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.

If we take the above clause seriously, then releasing any Haskell program in binary form requires reproducing the copyright notice"s" of all packages the program uses whenever the above clause applies. Cabal has all the license information (i.e. the type of license, and the location of copyright notices), so it can help users compile a license report during compilation based on the license types.

Therefore, I'd like to solve #701 by adding a field to IPI if the above arguments are convincing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants