Skip to content

Additional source provenance in SourceInfo#2009

Merged
gtristan merged 2 commits intomasterfrom
tristan/additional-source-provenance
Jul 22, 2025
Merged

Additional source provenance in SourceInfo#2009
gtristan merged 2 commits intomasterfrom
tristan/additional-source-provenance

Conversation

@gtristan
Copy link
Contributor

With the recent addition of SourceInfo etc, we are closer to generating automated SBoMs,
and to a reasonable degree, everything that should be delegated to plugins has been delegated
via the Source.collect_source_info() and SourceFetcher.get_source_info() abstract methods, and
the utility function utils.guess_version() for version guessing.

This leaves some information which only users can explicitly provide in their buildstream projects,
notably, it is relevant for SBoM generation and compliance purposes, to include information such
as the project homepage URL, and an existing issue tracking URL.

It is presumed that these cannot be realistically guessed by plugin implementations, and that
project authors would have to provide these in some form.

This patch adds some source level provenance information which users can use to contribute to
the SourceInfo.

@gtristan gtristan force-pushed the tristan/additional-source-provenance branch from c972493 to ffb1fc8 Compare May 14, 2025 10:41
gtristan added 2 commits May 15, 2025 15:50
With the recent addition of SourceInfo etc, we are closer to generating
automated SBoMs, and to a reasonable degree, everything that should be
delegated to plugins has been delegated via the Source.collect_source_info()
and SourceFetcher.get_source_info() abstract methods, and the utility function
utils.guess_version() for version guessing.

This leaves some information which only users can explicitly provide in
their buildstream projects.

This patch adds some source level provenance information which users can
use to contribute to the SourceInfo.

Explanation of the changes in this patch:

  * types.py: Add internal _SourceProvenance object

    This validates and parses user provided source provenance
    information.

  * _loader/metasource.py: Now carry the _SourceProvenance

  * _loader/types.py: Add the Symbol.PROVENANCE for consistency,
    as the element and loader are using this to parse common
    format related symbols.

  * element.py: Load the _SourceProvenance from source nodes and
    pass those through to the MetaSource constructor

  * source.py:

    - Add the "homepage" and "issue-tracker" user provided source
      provenance attributes to SourceInfo, and include those in the
      SourceInfo serialization.

    - Automatically pass these attributes on to SourceInfo objects
      constructed with Source.create_source_info(), so that there
      is no plugin participation required

    - Update documentation about the addition of the `provenance`
      dictionary since 2.5

    - Adhere to the new MetaSource constructor in `Source.__clone_for_uri()`
@gtristan gtristan force-pushed the tristan/additional-source-provenance branch from ffb1fc8 to d6d5e73 Compare May 15, 2025 06:50
@gtristan
Copy link
Contributor Author

It occurs to me that this patch has issues with multi-url sources like pip and cargo.

To address this, I would suggest extending Source.create_source_info() to add optional, keyword-only homepage and issue_tracker arguments, which can be used to provide this information differently using their own user configuration attributes.

@gtristan gtristan merged commit 8129838 into master Jul 22, 2025
17 checks passed
@gtristan gtristan deleted the tristan/additional-source-provenance branch July 22, 2025 09:21
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.

1 participant