You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by "joshua-zivkovic (via GitHub)" <gi...@apache.org> on 2025/11/28 08:37:46 UTC
[PR] Support multi source source provenance info [buildstream]
joshua-zivkovic opened a new pull request, #2098:
URL: https://github.com/apache/buildstream/pull/2098
Fixes https://github.com/apache/buildstream/issues/2073
Provides a way for multi-source plugins to provide source provenance info in their own way instead of only the top level source source info being used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2731988827
##########
src/buildstream/source.py:
##########
@@ -1386,15 +1387,23 @@ def create_source_info(
choice depicting the type of version.
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
+ provenance_node: The optional YAML node with source provenance attributes,
+ defaults to the provenance specified at the top level of the source.
Review Comment:
I believe this has been resolved with the `BST_CUSTOM_SOURCE_PROVENANCE` flag being introduced to block usage of top level provenance definitions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#issuecomment-3647019362
Do plugins need access to the actual `SourceProvenance` object or might it be sufficient to make the new `create_source_info()` parameter a `MappingNode` and let `create_source_info()` create a `_SourceProvenance` internally? This would expose less in the public API, but I'm not sure whether that would suffice or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2720399293
##########
tests/frontend/show.py:
##########
@@ -814,3 +814,33 @@ def test_source_info_workspace(cli, datafiles, tmpdir):
# There is no version guessing for a workspace
assert source_info.get_str("version-guess", None) is None
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, "source-info"))
+def test_multi_source_info(cli, datafiles):
+ project = str(datafiles)
+ result = cli.run(
+ project=project, silent=True, args=["show", "--format", "%{name}:\n%{source-info}", "multisource.bst"]
+ )
+ result.assert_success()
+
+ loaded = _yaml.load_data(result.output)
+ sources = loaded.get_sequence("multisource.bst")
+
+ source_info = sources.mapping_at(0)
+ assert source_info.get_str("kind") == "multisource"
+ assert source_info.get_str("url") == "http://ponyfarm.com/ponies"
+ assert source_info.get_str("medium") == "pony-ride"
+ assert source_info.get_str("version-type") == "pony-age"
+ assert source_info.get_str("version") == "1234567"
+ assert source_info.get_str("version-guess", None) == "12"
+ assert source_info.get_str("homepage") == "https://flying-ponies.com/index.html"
Review Comment:
Yes, I'm currently updating the tests to match the new behaviour
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721425985
##########
tests/frontend/source-info/elements/multisource.bst:
##########
@@ -0,0 +1,7 @@
+kind: import
+
+sources:
+- kind: multisource
+ ref:
+ - provenance:
+ homepage: https://flying-ponies.com/index.html
Review Comment:
I'm not sure I entirely see the benefit of having a specific test for provenance being provided from `ref`, actually. It isn't something that is explicitly supported.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "abderrahim (via GitHub)" <gi...@apache.org>.
abderrahim commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2717062528
##########
tests/frontend/show.py:
##########
@@ -814,3 +814,33 @@ def test_source_info_workspace(cli, datafiles, tmpdir):
# There is no version guessing for a workspace
assert source_info.get_str("version-guess", None) is None
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, "source-info"))
+def test_multi_source_info(cli, datafiles):
+ project = str(datafiles)
+ result = cli.run(
+ project=project, silent=True, args=["show", "--format", "%{name}:\n%{source-info}", "multisource.bst"]
+ )
+ result.assert_success()
+
+ loaded = _yaml.load_data(result.output)
+ sources = loaded.get_sequence("multisource.bst")
+
+ source_info = sources.mapping_at(0)
+ assert source_info.get_str("kind") == "multisource"
+ assert source_info.get_str("url") == "http://ponyfarm.com/ponies"
+ assert source_info.get_str("medium") == "pony-ride"
+ assert source_info.get_str("version-type") == "pony-age"
+ assert source_info.get_str("version") == "1234567"
+ assert source_info.get_str("version-guess", None) == "12"
+ assert source_info.get_str("homepage") == "https://flying-ponies.com/index.html"
Review Comment:
Is this test up to date? Shouldn't the homepage here be unset?
(also should we test for the warning/error condition?)
##########
src/buildstream/source.py:
##########
@@ -759,6 +759,14 @@ class Source(Plugin):
# The defaults from the project
__defaults: Optional[Dict[str, Any]] = None
+ BST_MULTI_SOURCE_PROVENANCE = False
Review Comment:
I would call this CUSTOM or something. While the main use is for sources that have multiple source fetchers that might want to have different source provenance, the *effect* of setting this flag is to allow the source to set its own source provenance programatically and prevent the buildstream core from parsing / using the provenance information from the top-level source configuration.
##########
src/buildstream/source.py:
##########
@@ -1387,14 +1396,32 @@ def create_source_info(
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
extra_data: Additional plugin defined key/values
+ provenance_node: The optional :class:`Node <buildstream.node.Node>` with source provenance attributes,
Review Comment:
nit: The -> An
##########
src/buildstream/source.py:
##########
@@ -1387,14 +1396,32 @@ def create_source_info(
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
extra_data: Additional plugin defined key/values
+ provenance_node: The optional :class:`Node <buildstream.node.Node>` with source provenance attributes,
+ defaults to the provenance specified at the top level of the source.
*Since: 2.5*
"""
homepage = None
issue_tracker = None
- if self.__provenance is not None:
- homepage = self.__provenance.homepage
- issue_tracker = self.__provenance.issue_tracker
+
+ provenance = None
+ if provenance_node is not None:
+ provenance: Optional[_SourceProvenance] = _SourceProvenance.new_from_node(provenance_node)
+ # if the source uses multiple sources but the individual source_info has
+ # no specified provenance data, skip it. We don't want to use top level
+ # data as a fallback because it'll just be wrong
+ elif self.BST_MULTI_SOURCE_PROVENANCE:
+ if self.__provenance is not None:
+ # This warning is printed for each occurrence of missing provenance
+ # for each sub-source, maybe it should be done just the once per
+ # multi-source?
+ self.warn("Multi source plugin: Not using top level source provenance")
Review Comment:
As a follow-up to my comment above, this shouldn't call them "Multi source plugin".
Also I'm not sure if this should be a warning or an error. I feel we should be strict with this, especially if this check runs early on in the pipeline (i.e. it's not only run if are looking for source info)
And please use the provenance (as in the `ProvenanceInformation`, not the `SourceProvenance`) in the error/warning message.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#issuecomment-3674477705
I've updated this branch as per my previous comment, but this still requires a test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2614168559
##########
src/buildstream/types.py:
##########
@@ -164,6 +164,65 @@ class OverlapAction(FastEnum):
"""
+# SourceProvenance()
+#
+# A simple object describing user provided source provenance information
+#
+# Args:
+# homepage: The source's homepage URL
+# issue_tracker: The source's issue reporting URL
+#
+class SourceProvenance:
+ def __init__(
+ self,
+ homepage: Optional[str],
+ issue_tracker: Optional[str],
+ ):
+ self.homepage: Optional[str] = homepage
+ self.issue_tracker: Optional[str] = issue_tracker
+
+ # new_from_node():
+ #
+ # Creates a SourceProvenance() from a YAML loaded node.
+ #
+ # Args:
+ # node: The configuration node describing the spec.
+ #
+ # Returns:
+ # The described SourceProvenance instance.
+ #
+ # Raises:
+ # LoadError: If the node is malformed.
+ #
+ @classmethod
+ def new_from_node(cls, node: MappingNode) -> "SourceProvenance":
+ node.validate_keys(
+ [
+ "homepage",
+ "issue-tracker",
+ ]
+ )
+
+ homepage: Optional[str] = node.get_str("homepage", None)
+ issue_tracker: Optional[str] = node.get_str("issue-tracker", None)
+
+ return cls(
+ homepage,
+ issue_tracker,
+ )
+
+ def serialize(self) -> Dict[str, str]:
+ provenance = {}
+
+ if self.homepage is not None:
+ provenance["homepage"] = self.homepage
+
+ if self.issue_tracker is not None:
+ provenance["issue-tracker"] = self.homepage
Review Comment:
```suggestion
provenance["issue-tracker"] = self.issue_tracker
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2731279970
##########
tests/frontend/show.py:
##########
@@ -814,3 +814,33 @@ def test_source_info_workspace(cli, datafiles, tmpdir):
# There is no version guessing for a workspace
assert source_info.get_str("version-guess", None) is None
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, "source-info"))
+def test_multi_source_info(cli, datafiles):
+ project = str(datafiles)
+ result = cli.run(
+ project=project, silent=True, args=["show", "--format", "%{name}:\n%{source-info}", "multisource.bst"]
+ )
+ result.assert_success()
+
+ loaded = _yaml.load_data(result.output)
+ sources = loaded.get_sequence("multisource.bst")
+
+ source_info = sources.mapping_at(0)
+ assert source_info.get_str("kind") == "multisource"
+ assert source_info.get_str("url") == "http://ponyfarm.com/ponies"
+ assert source_info.get_str("medium") == "pony-ride"
+ assert source_info.get_str("version-type") == "pony-age"
+ assert source_info.get_str("version") == "1234567"
+ assert source_info.get_str("version-guess", None) == "12"
+ assert source_info.get_str("homepage") == "https://flying-ponies.com/index.html"
Review Comment:
The incorrect homepage check has been removed. I'd suggest adding
```
assert "homepage" not in source_info
```
to check that the homepage is actually unset.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721299028
##########
src/buildstream/source.py:
##########
@@ -828,6 +836,12 @@ def __init__(
_SourceProvenance
] = meta.provenance # The _SourceProvenance for general user provided SourceInfo
+ if self.__provenance is not None and self.BST_CUSTOM_SOURCE_PROVENANCE:
+ raise SourceError(
+ f"{self._get_provenance()} Custom source plugin: Refusing to use top level source provenance",
Review Comment:
"Custom source plugin" is not clear to me. Did you mean "Custom source provenance" or maybe "Custom source provenance plugin"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#issuecomment-3654356318
Yup, taking in to account https://github.com/apache/buildstream/pull/2095#issuecomment-3596947680, there's no need to expose SourceProvenance to achieve this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721306448
##########
src/buildstream/source.py:
##########
@@ -828,6 +836,12 @@ def __init__(
_SourceProvenance
] = meta.provenance # The _SourceProvenance for general user provided SourceInfo
+ if self.__provenance is not None and self.BST_CUSTOM_SOURCE_PROVENANCE:
+ raise SourceError(
+ f"{self._get_provenance()} Custom source plugin: Refusing to use top level source provenance",
Review Comment:
Ah, that is definitely not what I meant to put :D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721290276
##########
tests/frontend/source-info/elements/multisource.bst:
##########
@@ -0,0 +1,7 @@
+kind: import
+
+sources:
+- kind: multisource
+ ref:
+ - provenance:
+ homepage: https://flying-ponies.com/index.html
Review Comment:
I don't think this is used, is it? An additional test with a test plugin that uses provenance from `ref` could be useful, but specifying it here without being used is confusing. I consider such an additional test a blocker as nice-to-have but not a blocker. If you add such a test, please keep the current test using `Node.from_dict` as we want to make sure that a plugin can also programmatically create provenance information from non-ref metadata.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2720387509
##########
src/buildstream/source.py:
##########
@@ -1387,14 +1396,32 @@ def create_source_info(
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
extra_data: Additional plugin defined key/values
+ provenance_node: The optional :class:`Node <buildstream.node.Node>` with source provenance attributes,
+ defaults to the provenance specified at the top level of the source.
*Since: 2.5*
"""
homepage = None
issue_tracker = None
- if self.__provenance is not None:
- homepage = self.__provenance.homepage
- issue_tracker = self.__provenance.issue_tracker
+
+ provenance = None
+ if provenance_node is not None:
+ provenance: Optional[_SourceProvenance] = _SourceProvenance.new_from_node(provenance_node)
+ # if the source uses multiple sources but the individual source_info has
+ # no specified provenance data, skip it. We don't want to use top level
+ # data as a fallback because it'll just be wrong
+ elif self.BST_MULTI_SOURCE_PROVENANCE:
+ if self.__provenance is not None:
+ # This warning is printed for each occurrence of missing provenance
+ # for each sub-source, maybe it should be done just the once per
+ # multi-source?
+ self.warn("Multi source plugin: Not using top level source provenance")
Review Comment:
I think we should indeed make this an error and move it to the `Source` constructor. I don't see a backward compatibility concern as there are no `BST_CUSTOM_SOURCE_PROVENANCE` source plugins yet. If needed, we could potentially be less strict in the future, while the other way round would be impossible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi merged PR #2098:
URL: https://github.com/apache/buildstream/pull/2098
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "abderrahim (via GitHub)" <gi...@apache.org>.
abderrahim commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2711659938
##########
src/buildstream/source.py:
##########
@@ -1386,15 +1387,23 @@ def create_source_info(
choice depicting the type of version.
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
+ provenance_node: The optional YAML node with source provenance attributes,
Review Comment:
It's probably better to refer to the Node class rather than saying a "YAML node"
##########
src/buildstream/source.py:
##########
@@ -1386,15 +1387,23 @@ def create_source_info(
choice depicting the type of version.
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
+ provenance_node: The optional YAML node with source provenance attributes,
+ defaults to the provenance specified at the top level of the source.
Review Comment:
I'm not sure this silent fallback semantic is good. IIUC, if the plugin provides a provenance for every source info, this will be silently ignored. If the plugin provides multiple source infos, and only some of them set provenance info (e.g. your implementation in https://gitlab.com/BuildStream/buildstream-plugins-community/-/merge_requests/408 if the user doesn't manually modify the ref to include provenance), then source infos that don't set it get the fallback of a global source provenance which is the same for everything.
I'm not sure what would be the best option here, but I feel the current implementation might not be a good idea.
##########
src/buildstream/source.py:
##########
@@ -1367,6 +1367,7 @@ def create_source_info(
version: str,
*,
version_guess: Optional[str] = None,
+ provenance_node: Optional[MappingNode] = None,
Review Comment:
nit: I would add this after extra_data.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721294765
##########
tests/sources/source_provenance_attributes/project.conf:
##########
@@ -0,0 +1,11 @@
+# Project with source provenance attributes
+name: foo
+min-version: 2.0
+
+element-path: elements
+
+# Don't allow any provenance
+source-provenance-fields: {}
Review Comment:
I think that test slipped in from the other PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721308649
##########
tests/sources/source_provenance_attributes/project.conf:
##########
@@ -0,0 +1,11 @@
+# Project with source provenance attributes
+name: foo
+min-version: 2.0
+
+element-path: elements
+
+# Don't allow any provenance
+source-provenance-fields: {}
Review Comment:
Yup, I'm about to push a fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "juergbi (via GitHub)" <gi...@apache.org>.
juergbi commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2721433933
##########
tests/frontend/source-info/elements/multisource.bst:
##########
@@ -0,0 +1,7 @@
+kind: import
+
+sources:
+- kind: multisource
+ ref:
+ - provenance:
+ homepage: https://flying-ponies.com/index.html
Review Comment:
I'm fine with skipping that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2731993269
##########
tests/frontend/show.py:
##########
@@ -814,3 +814,33 @@ def test_source_info_workspace(cli, datafiles, tmpdir):
# There is no version guessing for a workspace
assert source_info.get_str("version-guess", None) is None
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, "source-info"))
+def test_multi_source_info(cli, datafiles):
+ project = str(datafiles)
+ result = cli.run(
+ project=project, silent=True, args=["show", "--format", "%{name}:\n%{source-info}", "multisource.bst"]
+ )
+ result.assert_success()
+
+ loaded = _yaml.load_data(result.output)
+ sources = loaded.get_sequence("multisource.bst")
+
+ source_info = sources.mapping_at(0)
+ assert source_info.get_str("kind") == "multisource"
+ assert source_info.get_str("url") == "http://ponyfarm.com/ponies"
+ assert source_info.get_str("medium") == "pony-ride"
+ assert source_info.get_str("version-type") == "pony-age"
+ assert source_info.get_str("version") == "1234567"
+ assert source_info.get_str("version-guess", None) == "12"
+ assert source_info.get_str("homepage") == "https://flying-ponies.com/index.html"
Review Comment:
Added this in too, everything is happy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multi source source provenance info [buildstream]
Posted by "joshua-zivkovic (via GitHub)" <gi...@apache.org>.
joshua-zivkovic commented on code in PR #2098:
URL: https://github.com/apache/buildstream/pull/2098#discussion_r2712871608
##########
src/buildstream/source.py:
##########
@@ -1386,15 +1387,23 @@ def create_source_info(
choice depicting the type of version.
version: A string which represents a unique version of this source input
version_guess: An optional string representing the guessed human readable version
+ provenance_node: The optional YAML node with source provenance attributes,
+ defaults to the provenance specified at the top level of the source.
Review Comment:
Ah, that is something that has been completely overlooked yes. I think a "multi-source" plugin should simply have a flag that it sets when used to tell the core to not use top-level source provenance data and actually disallow it (preventing the top level being silently ignored)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org