gtristan commented on code in PR #1997:
URL: https://github.com/apache/buildstream/pull/1997#discussion_r2041867203
##########
src/buildstream/source.py:
##########
@@ -262,10 +261,147 @@ def __init__(
@dataclass
class AliasSubstitution:
+ """AliasSubstitution()
+ An opaque data structure which may be passed through
+ :func:`SourceFetcher.fetch() <buildstream.source.SourceFetcher.fetch>` and
in such cases
+ must be provided to :func:`Source.translate_url()
<buildstream.source.Source.translate_url>`.
+ """
+
_effective_alias: str
_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
+ """
+
+
+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 CAS digest representing the unique version of this source input
Review Comment:
> We could be more explicit about the {hash}/{size} format?
So I'm hoping to minimize how many types we put here, and I'm thinking along
the lines of:
* If its a `SourceInfoMedium.LOCAL`, then a `SourceVersionType.DIGEST` is a
CAS digest, which contains the necessary info (as you pointed out it should be
`{hash}/{size}`.
* If it's a `SourceInfoMedium.OCI_REGISTRY`, it just has the digest hash
Otherwise, we need to have a lot of explicit types.
On the other hand, as you point out... this makes it difficult to clearly
document the meaning of things... so perhaps I need a different `DIGEST` type
for OCI source plugins like the `docker` source ?
--
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]