Skip to content

Conversation

@joshua-zivkovic
Copy link

wip replacement for #2095

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>
@joshua-zivkovic joshua-zivkovic force-pushed the JZ/source-provenance branch 3 times, most recently from d18f672 to 6894c4f Compare January 8, 2026 14:13
Comment on lines 932 to 939
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()))
Copy link
Contributor

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.

Copy link
Author

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

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):
Copy link
Contributor

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.

Copy link
Author

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

Copy link
Author

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

@joshua-zivkovic joshua-zivkovic force-pushed the JZ/source-provenance branch 2 times, most recently from 0453ec5 to 81eb24a Compare January 9, 2026 11:34
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>
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.

2 participants