Skip to content

Fix up a few filesAnalyzed issues - #195

Merged
armintaenzertng merged 5 commits into
spdx:mainfrom
lhh:main
Oct 25, 2022
Merged

armintaenzertng merged 5 commits into
spdx:mainfrom
lhh:main

Conversation

@lhh

@lhh lhh commented Oct 19, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@lhh

lhh commented Oct 19, 2021

Copy link
Copy Markdown
Contributor Author

Looks like circleci stuff on mac is broken. I'm not quite sure how to fix it.

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Excellent catch!
Thank you ++
Could I interest you in adding a unit test too to avoid regression?

@pombredanne

pombredanne commented Oct 19, 2021 •

Copy link
Copy Markdown
Member

And sorry if I did update your branch by mistake with the latest. Let's pretend it was because of fat fingers.

@lhh

lhh commented Oct 20, 2021

Copy link
Copy Markdown
Contributor Author

Yes, of course. I'll add some tests.

@pombredanne

Copy link
Copy Markdown
Member

@lhh Thank you! you rock.

@lhh

lhh commented Oct 21, 2021

Copy link
Copy Markdown
Contributor Author

I am chasing possibly a bug in the RDF writer not handling multiple packages properly (particularly when one is filesAnalyzed = false), which is why that and the tag/value writer tests are not present yet. My apologies for the delay.

I'm out for a few days.

@dholth

dholth commented Nov 22, 2021

Copy link
Copy Markdown
Contributor

Should package_object["packageVerificationCode"] = self.package_verification_code( be optional or 'mandatory missing' per spec version 2.2 https://spdx.github.io/spdx-spec/package-information/#79-package-verification-code-field

@pombredanne

Copy link
Copy Markdown
Member

Should package_object["packageVerificationCode"] = self.package_verification_code( be optional or 'mandatory missing' per spec version 2.2 https://spdx.github.io/spdx-spec/package-information/#79-package-verification-code-field

@dholth this code is a source of troubles more often than not. We should make it optional in this library IMHO.

@armintaenzertng

Copy link
Copy Markdown
Collaborator

@lhh, do you still plan on updating this PR?

@lhh

lhh commented Oct 20, 2022

Copy link
Copy Markdown
Contributor Author

Ah, yes - my apologies. I'll address the above issues shortly.

@lhh
lhh force-pushed the main branch 2 times, most recently from d4a1415 to 03788d4 Compare October 20, 2022 15:17
jasinner
jasinner previously approved these changes Oct 21, 2022

@jasinner jasinner left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. I verified this fixed the bug described in #193

@goneall please merge this.

@armintaenzertng

Copy link
Copy Markdown
Collaborator

@pombredanne you still have a blocker on this PR. As I don't want to dismiss your review, would you care to have a short look at it again?

pombredanne
pombredanne previously approved these changes Oct 21, 2022

@nicoweidner nicoweidner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left two minor questions. Thanks for the contribution!

Comment thread tests/utils_test.py Resolved
Comment thread tests/utils_test.py Resolved
lhh added 5 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>

@nicoweidner nicoweidner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing my questions! I didn't look at the remaining code in detail, but two other reviewes already approved, so this should be good to merge

@armintaenzertng
armintaenzertng merged commit 5fb15bd into spdx:main Oct 25, 2022
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.

6 participants