AdrianVovk commented on code in PR #62:
URL:
https://github.com/apache/buildstream-plugins/pull/62#discussion_r1534728913
##########
src/buildstream_plugins/sources/cargo.py:
##########
@@ -294,6 +308,166 @@ def _get_mirror_file(self, sha=None):
return os.path.join(self._get_mirror_dir(), sha or self.sha)
+# Locks on repositories for write access
+REPO_LOCKS = {}
+
+
+# CrateGit()
+#
+# Use a SourceFetcher class to be the per crate helper.
+#
+# This one is for crates fetched from git repositories.
+#
+# Args:
+# cargo (Cargo): The main Source implementation
+# name (str): The name of the crate to depend on
+# version (str): The version of the crate to depend on
+# repo (str): Repository URL
+# commit (str): Sha of the git commit
+class CrateGit(SourceFetcher):
+ def __init__(self, cargo, name, version, repo, commit):
+ super().__init__()
+
+ self.cargo = cargo
+ self.name = name
+ self.version = str(version)
+ self.repo = repo
+ self.commit = commit
+ # TODO: Is this right?
+ self.mark_download_url(self.repo)
Review Comment:
:+1: ok I like it.
Small concern; it should behave like keys. That way projects can configure a
bunch of project-wide `git_mirrors` so it doesn't have to be specified in each
element, but also if you _do_ need to configure something per-element you can
just configure it
With your proposal right now, the set-up would need to look like:
```
sources:
- kind: cargo
git_mirrors:
(>):
- https://github.com/x/y: https://mirror.example.org/x/y
- https://github.com/a/b: my-alias:a/b
```
to avoid overwriting the project-wide config
Of course, domains don't fit into YAML syntax, so maybe what I'm asking for
isn't possible :shrug:
--
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]