gtristan commented on code in PR #1997:
URL: https://github.com/apache/buildstream/pull/1997#discussion_r2068689644
##########
src/buildstream/source.py:
##########
@@ -272,6 +420,208 @@ class AliasSubstitution:
_mirror: Union[SourceMirror, str]
+class SourceInfoMedium(FastEnum):
+ """
+ Indicates the medium in which the source is obtained
+
+ *Since: 2.5*
+ """
+
+ WORKSPACE = "workspace"
+ """
+ Files in an open workspace
+ """
+
+ LOCAL = "local"
+ """
+ Files stored locally in the project
+ """
+
+ REMOTE_FILE = "remote-file"
+ """
+ A remote file
+ """
+
+ GIT = "git"
+ """
+ A git repository
+ """
+
+ BAZAAR = "bzr"
+ """
+ The Bazaar revision control system
+ """
+
+ OCI_IMAGE = "oci-image"
+ """
+ An OCI image, such as docker or podman images.
+ """
+
+ PYTHON_PACKAGE_INDEX = "pypi"
+ """
+ A python package obtained from a python package index like https://pypi.org
+ """
+
+
+class SourceVersionType(FastEnum):
+ """
+ Indicates the type of the version string
+
+ *Since: 2.5*
+ """
+
+ COMMIT = "commit"
+ """
+ A commit string which accurately represents a version in a source
+ code repository or VCS
+ """
+
+ SHA256 = "sha256"
+ """
+ An sha256 checksum
+ """
+
+ DIGEST = "digest"
+ """
+ A digest representing the unique version of this source input.
+ """
+
+ INDEXED_VERSION = "indexed-version"
+ """
+ This type of version is used in cases where we have repositories which
+ have an interface to index content by version, and that no additional
validation
+ is performed to insure the uniqueness of the downloaded content (not
recommended).
+
+ In the case of plugins which use this version type, it is probable that
+ ``SourceInfo.guess_version == SourceInfo.version``.
+ """
+
+
+class SourceInfo:
+ """SourceInfo()
+
+ An object representing the provenance of input reported by
+ :func:`Source.collect_source_info()
<buildstream.source.Source.collect_source_info>`
+ and/or :func:`SourceFetcher.get_source_info()
<buildstream.source.SourceFetcher.get_source_info>`
+
+ See: :ref:`documentation on generating SourceInfo <core_source_info>`.
+
+ .. attention::
+
+ A given SourceInfo for a given element is **not** guaranteed to be
unique for
+ a given :ref:`cache key <cachekeys>`.
+
+ While given well behaved source plugins, it is expected to obtain the
same *cache keys*
Review Comment:
Hmmm ok that's interesting and true.
For example, even considering unchanging element configurations, the
directory where a source is *staged* is a source configuration which will/must
effect cache keys, but is unrelated to source *provenance* and is not necessary
in the SourceInfo.
I'll think of a better way to reword 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]