#22 Improve license check to use licensecheck from rpmdevtools
Closed: Fixed None Opened 12 years ago by sochotni.

licensecheck output would need to be somewhat filtered, but it should be doable relatively easily.

Then we can add this to a license check question so that dev has easier time to spot obvious problems.


Replying to [ticket:22 sochotni]:

licensecheck output would need to be somewhat filtered, but it should be doable relatively easily.

Then we can add this to a license check question so that dev has easier time to spot obvious problems.

I'm working on this.

pushed it..can you have a look? :)

Just reviewing the commits on gitweb I have a question.

Why only return the unknown license ?

I actually would find interesting to get:
all the different licenses found in the project
the files for which unknown licenses were found

One way to do that would be:
run licensecheck and populate attributes
retrieve the attributes from the object in the check and display them

What do you think ?

Replying to [comment:4 pingou]:

Just reviewing the commits on gitweb I have a question.

Why only return the unknown license ?

I actually would find interesting to get:
all the different licenses found in the project
good point. But I think a big list of found licenses would not be of great help. Maybe we can check for forbidden/unknown licenses and prompt them? Is this possible? We would need some kind of easy queryable license blacklist. Maybe we can use directly the list on fedoraproject.org/wiki/Packaging/LicensingGuidelines?
the files for which unknown licenses were found
my check is doing this already. the full qualified file path is displayed.

One way to do that would be:
run licensecheck and populate attributes
you are talking about some self.var thingy in class SRPMFile?
retrieve the attributes from the object in the check and display them
so I should not return a list in function licensecheck?

What do you think ?

Replying to [comment:5 brummbq]:

Replying to [comment:4 pingou]:

Just reviewing the commits on gitweb I have a question.

Why only return the unknown license ?

I actually would find interesting to get:
all the different* licenses found in the project
good point. But I think a big list of found licenses would not be of great help.

Well actually, I would be interested to know if there are files licensed under GPLv2 and GPLv3+
or apache license mixed with GPL.
Of course the idea is to return only the different license (not a bunch of GPLv2+).

To be honest I am kind of speaking for the top of my head, I do not know the output from lincesecheck.

  • the files for which unknown licenses were found
    my check is doing this already. the full qualified file path is displayed.

Cool :)

One way to do that would be:
* run licensecheck and populate attributes
you are talking about some self.var thingy in class SRPMFile?

Yes

  • retrieve the attributes from the object in the check and display them
    so I should not return a list in function licensecheck?

Yes but only to avoid returning for example a tuple of lists or a list of lists, but that's a minor detail :).

My idea was:
{{{
[ ]: MUST License field in the package spec file matches the actual license.
Licenses found: GPLV2, ASL2.0, ....
For detailed output of license check see file XXX
[ ] ....
}}}

I don't actually think showing unknown license files to be worthwhile. In most project this will be a huge list of files that don't have headers. A lot of projects just state license in LICENSE/COPYING/WHATEVER and don't bother otherwise.

As for the code:
* I'd prefer if all code is merged into CheckLicenseField check. I'd even suggest moving stuff from SRPMFile because it makes more sense to me that way.
{{{
+ source_dir = self.get_mock_dir() + \
+ "/../root/builddir/build/sources/" + \
+ source_files_dir
}}}
* ^^ This should probably use srpmfile.get_build_dir instead. Your code is making more assumptions (i.e. name-version). At least on my computer this doesn't work (last dir is called "SOURCES" not "sources"

Oh, and just looked at the source itself and your editor is leaving behing trailing newlines :-)

hey guys, first of all: thank you for being so helpful and patient. I just pushed a new licensecheck version.

Replying to [comment:7 sochotni]:

My idea was:
{{{
[ ]: MUST License field in the package spec file matches the actual license.
Licenses found: GPLV2, ASL2.0, ....
For detailed output of license check see file XXX
[ ] ....
}}}

I don't actually think showing unknown license files to be worthwhile. In most project this will be a huge list of files that don't have headers. A lot of projects just state license in LICENSE/COPYING/WHATEVER and don't bother otherwise.
I admit your idea is better, so I have implemented it. ;)

As for the code:
* I'd prefer if all code is merged into CheckLicenseField check. I'd even suggest moving stuff from SRPMFile because it makes more sense to me that way.
{{{
+ source_dir = self.get_mock_dir() + \
+ "/../root/builddir/build/sources/" + \
+ source_files_dir
}}}
* ^^ This should probably use srpmfile.get_build_dir instead. Your code is making more assumptions (i.e. name-version). At least on my computer this doesn't work (last dir is called "SOURCES" not "sources"
And on my computer there is no srpmfile.get_build_dir :( I don't know how to do this right. Also licensecheck needs the source dir (where the source files are) and not the build dir. Or am I mixing something up?

Replying to [comment:8 sochotni]:

Oh, and just looked at the source itself and your editor is leaving behing trailing newlines :-)
I'm using eclipse/pydev. I believe I fixed it (checked Right trim line option).

Looks good I'd say, seems to work for me now. Nice work! As far as I am concerned this feature is done, the code just needs a bit better error handling but otherwise is OK

Login to comment on this ticket.

Metadata