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

Updated SPDX related files in light of 2.0 release of SPDX specification #4208

Merged
merged 3 commits into from Jul 3, 2015

Conversation

alcohol
Copy link
Member

@alcohol alcohol commented Jul 2, 2015

Not sure if desired or not, but figured it was time for an update.

@alcohol
Copy link
Member Author

alcohol commented Jul 2, 2015

@Seldaek or @stof ; where could I find some details regarding isValidLicenseString() from the SpdxLicense class? It's a bit.. cryptic (for me at least).

@stof
Copy link
Contributor

stof commented Jul 2, 2015

@alcohol this method is parsing strings like (LGPL-2.0 or GPL-3.0+). the cryptic thing is a lexer and a parser

@stof
Copy link
Contributor

stof commented Jul 2, 2015

and failing tests are because some of the licenses used by the tests are now removed from the SPDX list (see the diff on the JSON file)

@alcohol
Copy link
Member Author

alcohol commented Jul 2, 2015

Yeah I figured parts of it out.

I was thinking, do we still want to add the deprecated licenses to the current list and add a deprecated attribute?

I fixed the tests btw but it doesn't support the new specification fully yet, need to add additional tests for that.

@stof
Copy link
Contributor

stof commented Jul 2, 2015

I would say no. We should rather support the new SPDX way to provide such licenses.
Using GPL-3.0+ as a project license is not deprecated. The way to consider it changed.

@alcohol
Copy link
Member Author

alcohol commented Jul 2, 2015

Btw the notation of (A or|and B), is that defined by SPDX or something Composer adds on top?

@stof
Copy link
Contributor

stof commented Jul 2, 2015

I don't remember whether it was part of SPDX 1 or no. But it is part of SPDX 2 for sure (look at the spec for license expressions, and you will see it covers them)

@@ -220,6 +221,7 @@ private function isValidLicenseString($license)
$require = 0;
break;
case 'ws':
case 'pl':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pl should not be allowed anywhere. It can only follow a license identifier

@alcohol
Copy link
Member Author

alcohol commented Jul 2, 2015

Just a thought; would you guys be at all opposed to the idea of extracting the SPDX related stuff into package by itself?

@@ -144,8 +144,9 @@ private function isValidLicenseString($license)
'op' => '(?:or|and)',
'lix' => '(?:NONE|NOASSERTION)',
'lir' => 'LicenseRef-\d+',
'lic' => '[-+_.a-zA-Z0-9]{3,}',
'lic' => '[-_.a-zA-Z0-9]{3,}',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just having the \+? here at the end would be fine and then rtrim it in isValidLicenseIdentifier?

@stof
Copy link
Contributor

stof commented Jul 2, 2015

@alcohol I thought about doing exactly that when reviewing this PR

@alcohol
Copy link
Member Author

alcohol commented Jul 2, 2015

This covers it all and makes it relatively easy to extract. However, it's not incredibly elegant.. so yeah, feedback/thoughts/suggestions?

*/
private function isValidLicenseString($license)
{
$tokens = array(
'po' => '\(',
'pc' => '\)',
'op' => '(?:or|and)',
'op' => '(?:OR|AND)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest allowing the lower case versions too, to keep BC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the tests don't allow mixed casing. So just using a case insensitive modifier wouldn't work. It would then be or|OR|and|AND. But the specs explicitly only use uppercase. You sure you want to keep BC for this?

@Seldaek
Copy link
Member

Seldaek commented Jul 2, 2015

Looks good to me, are you done done @alcohol? :)

@alcohol
Copy link
Member Author

alcohol commented Jul 3, 2015

/cc @stof @Seldaek can you guys let me know if you prefer the tokenizer over the regex?

array("MIT (MIT and MIT)"),
array("(MIT and MIT) MIT"),
array(array("LGPL-2.0", "The system pwns you")),
array("and GPL-3.0+"),
array("EUDatagrid and GPL-3.0+"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this one actually valid now ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always was valid actually. I don't know why it was not marked as valid.

I mean, it should have been considered valid. I don't know why it didn't pass before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex does match a string such as "MIT AND MIT" though. So I guess it's not good enough :-/

@alcohol
Copy link
Member Author

alcohol commented Jul 3, 2015

Reverted it so it stays available in history, if someone ever wants to revisit it.

@alcohol
Copy link
Member Author

alcohol commented Jul 3, 2015

Not sure why "EUDatagrid and GPL-3.0+" is considered invalid now. Going to investigate that.

Edit: ok so the specs say that composite license expressions SHOULD be encapsulated by parentheses to facilitate expression parsing (not MUST be by the way). That's probably why the tokenizer approach failed them (on purpose). The regex does not accommodate that either.

@alcohol
Copy link
Member Author

alcohol commented Jul 3, 2015

Rebased it for now.

/cc @Seldaek Ready to merge and then extract to self contained package.

Seldaek added a commit that referenced this pull request Jul 3, 2015
Updated SPDX related files in light of 2.0 release of SPDX specification
@Seldaek Seldaek merged commit 01a9c3a into composer:master Jul 3, 2015
@Seldaek
Copy link
Member

Seldaek commented Jul 3, 2015

Cool thanks

@alcohol alcohol deleted the update-spdx-updater branch September 29, 2016 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants