-
Notifications
You must be signed in to change notification settings - Fork 39
Generic Source Provenance #2099
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
base: master
Are you sure you want to change the base?
Generic Source Provenance #2099
Conversation
This allows multi-source source plugins to provide this information per source rather than as a singular top level. This is done by adding a `provenance_node` parameter to `create_source_info()` that when specified overrides the use of the source's top level source provenance info. Co-authored-by: Jürg Billeter <j@bitron.ch>
d18f672 to
6894c4f
Compare
src/buildstream/source.py
Outdated
| def load_source_provenance(self, node: MappingNode) -> None: | ||
| raise ImplError("Source plugin '{}' does not implement load_source_provenance()".format(self.get_kind())) | ||
|
|
||
| def get_source_provenance(self) -> SourceProvenance: | ||
| raise ImplError("Source plugin '{}' does not implement get_source_provenance()".format(self.get_kind())) | ||
|
|
||
| def set_source_provenance(self, source_provenance: SourceProvenance): | ||
| raise ImplError("Source plugin '{}' does not implement set_source_provenance()".format(self.get_kind())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To retain backward compatibility, we can't require source plugins to implement these methods. I.e., we need (trivial) default implementations for any method that is called unconditionally by the core. API documentation will be required as well, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's easy enough if we just go with a "do nothing" implementation
src/buildstream/source.py
Outdated
| def set_source_provenance(self, source_provenance: SourceProvenance): | ||
| raise ImplError("Source plugin '{}' does not implement set_source_provenance()".format(self.get_kind())) | ||
|
|
||
| def track(self, *, previous_sources_dir: Optional[str] = None) -> (SourceRef, SourceProvenance): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to find a way to allow returning a SourceProvenance without breaking API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that might be more difficult to work out. I'll see if I can work something sensible out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I've gone with combining the old and new return signatures (https://github.com/apache/buildstream/pull/2099/files#diff-48200ef302e5d841cce81834e8879a65e59db922a22605b9d7fa16b4dd5c7067R941) and added some logic to unpackage it appropriately (https://github.com/apache/buildstream/pull/2099/files#diff-48200ef302e5d841cce81834e8879a65e59db922a22605b9d7fa16b4dd5c7067R1811). I believe that's all that's required to not break the API here
0453ec5 to
81eb24a
Compare
Remove harcoded SPDX attributes and make them be generic instead. Project allowed attributes are configured via the project config, these supported values a determined by buildstream-sbom's support Co-authored-by: Jürg Billeter <j@bitron.ch> Co-authored-by: Joshua Zivkovic <joshuazivkovic@codethink.co.uk>
81eb24a to
bb44761
Compare
wip replacement for #2095