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

gh-114250: Fetch metadata for pip and its vendored dependencies from PyPI #114450

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

sethmlarson
Copy link
Contributor

@sethmlarson sethmlarson commented Jan 22, 2024

Closes #114240
Closes #114244
Closes #114250

Works when the pip wheel is missing from the Lib/ensurepip/_bundled directory. Ran the resulting SBOM end-to-end with the proposed release script as well.

@@ -31,14 +38,13 @@
"checksums",
"licenseConcluded",
"externalRefs",
"originator",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This field isn't required by NTIA Minimum Elements, only supplier is required.

return download_url, checksum_sha256

except (OSError, ValueError) as e:
# Fail if we're running in CI where we should have an internet connection.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the fetch fails in CI we error out, otherwise for local runs we skip.

@hugovk
Copy link
Member

hugovk commented Jan 23, 2024

@befeleme How's this, does it fit into your workflow?

@sethmlarson sethmlarson requested a review from hugovk January 24, 2024 19:41
@befeleme
Copy link
Contributor

I was able to build Python with this version of the script successfully. I have not found the SBOM json file anywhere in the built RPM artifacts. I don't know whether the script actually did anything during the build. From this point of view, with no expectation that we'll actually ship the SBOM file, I'd say it fits into our workflow via not changing anything in it.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Thanks both!

@hugovk hugovk enabled auto-merge (squash) January 26, 2024 09:48
@hugovk hugovk merged commit 582d95e into python:main Jan 26, 2024
37 checks passed
@sethmlarson sethmlarson deleted the sbom-fetch-metadata branch January 26, 2024 15:39
@sethmlarson
Copy link
Contributor Author

Thanks Hugo and Karolina!

Comment on lines +257 to +260
# We couldn't fetch any metadata from PyPI,
# so we give up on verifying if we're not in CI.
if pip_metadata is None:
return
Copy link
Contributor

@hroncok hroncok Feb 7, 2024

Choose a reason for hiding this comment

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

When this happens and the pip wheel is there, the build fails when offline as commented on #114240 (comment)

  • the pip vendored dependencies will not be in PACKAGE_TO_FILES
  • the pip vendored dependencies will not be in expected_names in main()
  • the pip vendored dependencies are not removed from sbom_data
  • the actual_names != expected_names condition is met and the script errors

aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants