gtristan commented on code in PR #1997:
URL: https://github.com/apache/buildstream/pull/1997#discussion_r2055283247


##########
src/buildstream/source.py:
##########
@@ -262,10 +262,123 @@ 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 meduim in which the source is obtained
+
+    *Since: 2.5*
+    """
+
+    LOCAL = "local"
+    """
+    Files stored locally in the project
+    """
+
+    ARCHIVE = "archive"
+    """
+    An archive file
+    """
+
+    GIT = "git"
+    """
+    A git repository
+    """
+
+
+class SourceVersionType(FastEnum):
+    """
+    Indicates the type of the version string
+
+    *Since: 2.5*
+    """
+
+    VERSION = "version"
+    """
+    The upstream version string, which may be semantic version
+    """
+
+    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
+    """
+
+
+class SourceInfo:
+    """SourceInfo()
+
+    An object representing the provenance of input reported by
+    :func:`Source.collect_source_info() 
<buildstream.source.Source.collect_source_info>`
+
+    *Since: 2.5*
+    """
+
+    def __init__(self, url: str, medium: str, version_type: str, version: str):
+        # XXX assert medium and version_type are valid values for the enums
+
+        self.url: str = url
+        """
+        The url of the source input
+        """
+
+        self.medium: str = medium
+        """
+        The :class:`.SourceInfoMedium` of the source input
+        """
+
+        self.version_type: str = version_type

Review Comment:
   I'm going to leave this open as a reminder that there is STILL a missing 
part from this patch, which is adding support for specifying explicit versions 
in existing plugins in yaml.
   
   For instance, if I have a git tag or a tarball with a name like 
`pony-rider-fork-with-gallop-support.tgz` on some hosting, where they did not 
specify a meaningful version, but the version is expressed in some other way, 
e.g. in the project readme, or is listed on a main page and indexed with some 
sha like 
`https://flying-ponies.com/releases/5a9121c44e888f7c5cd7060dfb153e0e9f2f2e95/pony-release.tgz`,
 it cannot be matched or guessed with any pattern regex.
   
   In this case we need `downloadablefilesource.tgz` and any plugins to allow 
some source level configuration to explicitly specify these user provided 
overrides, for that plugin to prioritize and use in their 
`Source.collect_source_info()` implementations.
   
   



-- 
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]

Reply via email to