Skip to content

ISSUES-196 parse spdx 2.2 - #250

Closed
jasinner wants to merge 7 commits into
spdx:mainfrom
jasinner:ISSUES-196-parse-spdx-2.2
Closed

jasinner wants to merge 7 commits into
spdx:mainfrom
jasinner:ISSUES-196-parse-spdx-2.2

Conversation

@jasinner

@jasinner jasinner commented Oct 25, 2022 •

Copy link
Copy Markdown

Attempt to address #196

TODO:

  • Test validator for documentDescribes
  • Add documentDescribes to writers

I took the SPDX Example files from here and tried to update the existing tests to work with them.

This PR includes the commits from #195

I think all the parser issues are fixed now, at least for XML, YAML, and JSON. TagValue, and RDF are harder for me because I'm not familiar with the syntax of those.

There are failing tests in test_conversion.py and test_write_anything.py. I'm almost ready to give up trying to fix the TagValue and RDF writers, because I can't figure out how to fix them, help appreciated!

I haven't look at test_conversion.py yet, but I'm thinking it will be similar. Possible for XML, YAML, and JSON, but harder for TagValue and RDF.

lhh and others added 7 commits October 21, 2022 10:04
When filesAnalyzed is False, several sections should be omitted
when writing rather than being presented as empty sets or "None".

SPDX 2.2, sec:
  3.8.3 - files analyzed specification
  3.9.3 - verification code
  3.14.3 - licenses from files

Without doing this, invalid SPDX documents are written and cannot be
parse by the parser.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
xmltodict is used to generate a Python dictionary from
XML tags. Unfortunately, it does not transmogrify CDATA
"true" or "false" to their Python bool representation,
so we must do it ourselves.

Add this to the XML example for testing purposes.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
Reading in SPDX BOMs with multiple packages produces a list
of dictionaries, which cannot be sorted (throws a TypeError)

Signed-off-by: Lon Hohberger <lhh@redhat.com>
When multiple packages are present, some may have
filesAnalyzed set to True, others set to False.

Make sure we test both cases.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
The SPDX specification holds that the package verification code
is mandatory whenever files_analyzed is True or none (omitted),
however, for the purposes of this library, we make it optional
here.

Signed-off-by: Lon Hohberger <lhh@redhat.com>
…ication.

Signed-off-by: Jason Shepherd <jason@jasonshepherd.net>
@nicoweidner

Copy link
Copy Markdown
Collaborator

@jasinner Thanks a lot for the contribution!
I hope I'll be able to have a look soon, but we still have a backlog of open PRs to work through (as you noticed, this repo was quite inactive for a while, we are trying to bring it up to speed now). The two PRs #197 and #200 seem to overlap (didn't check in detail though), so we'll try to get those in soon and then see where we stand here.

... in case I'm completely wrong about the overlap, please feel free to point it out 😅

@nicoweidner nicoweidner added the blocked Blocked by some other PR or issue. Details should be mentioned in comments. label Oct 25, 2022
@jasinner

jasinner commented Oct 25, 2022 •

Copy link
Copy Markdown
Author

I think getting PR #197 in before this one is necessary. The flatten/un-flatten approach allows for better backward compatiability then the changes I'm proposing here. PR #200 seem to have a bigger focus on XML parser/writing which is complimentary to that PR.

I think perhaps mine won't be necessary once those 2 PRs are merged, you are correct. Sorry I didn't look closer at them earlier. We'll need to get PR #195 in too I think.

@meretp meretp mentioned this pull request Nov 9, 2022
@nicoweidner

Copy link
Copy Markdown
Collaborator

@jasinner In case you remember, would you mind listing which issues this PR addresses (in units as small as possible)? The linked issue is a bit vague and encompasses different issues. With all the concurrent PRs that had piled up, things got a bit chaotic. I suspect that a lot of things (or even all?) are already fixed on main.

@nicoweidner

Copy link
Copy Markdown
Collaborator

@jasinner Now that the general chaos subsided, I believe this PR has become redundant, unfortunately. I will leave this up for a while before closing it - please ping if you see some changes that should still make it into main.
Sorry for all effort spent on this PR that might not get merged in the end!

@nicoweidner

Copy link
Copy Markdown
Collaborator

I think this is now redundant. If anyone disagrees, please ping me.

@nicoweidner nicoweidner closed this Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Blocked by some other PR or issue. Details should be mentioned in comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants