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

Report Debian package licenses in default report #1029

Merged
merged 1 commit into from
Nov 19, 2021
Merged

Report Debian package licenses in default report #1029

merged 1 commit into from
Nov 19, 2021

Conversation

mukultaneja
Copy link
Contributor

Adds a new column 'Pkg Licenses' in the table
to report package licenses as part of default
report

Resolved: #989

Signed-off-by: Mukul Taneja [email protected]

@rnjudge
Copy link
Contributor

rnjudge commented Sep 17, 2021

This works, but we may need to re-think this as it completely messes up the table formatting to be unreadable with the default format -- something I was not expecting!! Let me (or if you want to, feel free @mukultaneja ) take a look at the PrettyTable python library and see if there's any way to wrap cells.

@mukultaneja
Copy link
Contributor Author

@rnjudge, Please review the recent changes where I am using textwrap python module to wrap the cell value. After this change I am getting the report like below [ a brief glance ]

	| ncurses-base           | 6.2+20201114-2               | X11, BSD-3-clause, MIT/X11                                             | deb        |
	| ncurses-bin            | 6.2+20201114-2               | X11, BSD-3-clause, MIT/X11                                             | deb        |
	| passwd                 | 1:4.8.1-1                    |                                                                        | deb        |
	| perl-base              | 5.32.1-4+deb11u1             | GPL-1+ or Artistic, and BSD-4-clause-POWERDOG, GPL-1+ or Artistic or   | deb        |
	|                        |                              | Artistic-dist, RRA-KEEP-THIS-NOTICE, Expat or GPL-1+ or Artistic,      |            |
	|                        |                              | DONT-CHANGE-THE-GPL, Expat, TEXT-TABS, BZIP, ZLIB, Artistic-dist,      |            |
	|                        |                              | GPL-2+, BSD-4-clause-POWERDOG, Artistic-2, REGCOMP, Artistic, GPL-1+   |            |
	|                        |                              | or Artistic, and Unicode, LGPL-2.1, GPL-2+ or Artistic, GPL-1+,        |            |
	|                        |                              | BSD-3-clause, SDBM-PUBLIC-DOMAIN, CC0-1.0, Unicode, GPL-3+-WITH-BISON- |            |
	|                        |                              | EXCEPTION, Artistic or GPL-1+ or Artistic-dist, BSD-3-clause-with-     |            |
	|                        |                              | weird-numbering, REGCOMP, and GPL-1+ or Artistic, GPL-1+ or Artistic,  |            |
	|                        |                              | GPL-1+ or Artistic, and Expat, HSIEH-DERIVATIVE, HSIEH-BSD,            |            |
	|                        |                              | BSD-3-clause-GENERIC, GPL-1+ or Artistic, and BSD-3-clause-GENERIC     |            |
	| sed                    | 4.7-1                        |                                                                        | deb        |```

@nishakm
Copy link
Contributor

nishakm commented Oct 2, 2021

@rnjudge Is this good to go?

@rnjudge
Copy link
Contributor

rnjudge commented Oct 4, 2021

@mukultaneja did you have a chance to check if the PrettyTable library has a way to wrap text in cells?

@mukultaneja
Copy link
Contributor Author

@rnjudge, I tried that but did not get many options except set_style but this does not support data wrapping as we are looking for here.

@rnjudge
Copy link
Contributor

rnjudge commented Nov 3, 2021

Hi @mukultaneja, sorry for the delay. I tested this with a non-debian image and I get an issue with the output. Each letter of the license is printed on a separate line. For photon:3.0:

Screen Shot 2021-11-02 at 8 00 40 PM

I think I know the fix, will comment in-line. Would also like you to add the following change in line 105 of default/generator.py file:

-  package_list.field_names =  ["Package", "Version", "License", "Pkg Format"]
+  package_list.field_names = ["Package", "Version", "License(s)", "Pkg Format"]

@rnjudge rnjudge linked an issue Nov 4, 2021 that may be closed by this pull request
@mukultaneja
Copy link
Contributor Author

@rnjudge I have taken care of all your suggestions, please review the PR once again.

@rnjudge
Copy link
Contributor

rnjudge commented Nov 15, 2021

@mukultaneja A few small nits in the formatting and this is ready to go. Also, can you please update your commit message? It currently says Adds a new column 'Pkg Licenses' in the table which is not what the commit does anymore. Something like this would be great:

Report Debian package licenses in default report

Include Debian package licenses in the default report table and wrap
the table column width at 45 characters so the table renders as a
reasonable size.

Resolves: #989

Signed-off-by: Mukul Taneja <[email protected]>

Include Debian package licenses in the default report table
and wrap the table column width at 45 characters so the table
renders as a reasonable size.

Resolved: #989

Signed-off-by: Mukul Taneja <[email protected]>
@mukultaneja mukultaneja requested a review from rnjudge November 15, 2021 20:50
@mukultaneja
Copy link
Contributor Author

@rnjudge, Please review the changes!

@rnjudge
Copy link
Contributor

rnjudge commented Nov 16, 2021

@mukultaneja LGTM!

@mukultaneja
Copy link
Contributor Author

@rnjudge @nishakm is it good to go then?

@rnjudge rnjudge merged commit 38d5c76 into tern-tools:main Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants