-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SE-0219 Package Manager Dependency Mirroring #1776
Conversation
5fd3024
to
9192adc
Compare
c943fd6
to
3dd4883
Compare
<rdar://problem/42511642> [SR-8328]: Implement SE-0219 Package Manager Dependency Mirroring https://bugs.swift.org/browse/SR-8328
@swift-ci smoke test |
@swift-ci test with toolchain |
@swift-ci smoke test macOS |
@swift-ci smoke test OS X |
return mirrors[url]?.mirror | ||
} | ||
|
||
/// Returns the tr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure what the tr
stands for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is a typo. I think I wanted to write something like:
/// Returns the mirrored url if it exists, otherwise the original url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: 00e8771
|
||
// Test deletion. | ||
try execute(["config", "unset-mirror", "--package-url", "https://github.com/foo/bar"], packagePath: packageRoot) | ||
try execute(["config", "unset-mirror", "--mirror-url", "[email protected]:foo/swift-package-manager.git"], packagePath: packageRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposal mentions to implement unset-mirror --all
but it's not yet implemented.
Proposal
Usacase
what next?
This can be done in two ways at least from my naive eye:
- use the options parses as all of
get-mirror
andset-mirror
orunset-mirror
is done. Internally ask the json from file and remove each one. - Parse and then remove the entire json object from the file at once.
.swiftpm/config
Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we currently only store the mirror information in the config file, I don't see a need to implement the --all
flag. The user can just delete config file by hand for now. We can add the flag in the future when we start adding more stuff in the config file.
Maybe this is too late, anyways I want to point to a scenario. When the user attempts to set a mirror-url for given package url like such: $ spm package config set-mirror --package-url pkg1 --mirror-url pkg2 (1)
$ spm package config get-mirror --package-url pkg1
// pkg2
$ spm package config set-mirror --package-url pkg2 --mirror-url pkg3 (2)
/// pkg1 --mirror--> pkg2
/// pkg2 --mirror--> pkg3 1 we dont verify if the provided package-url is present in the list of dependencies user specified in 2 This is partly a side effect of not having check as described in point 1. The main question is These are my opinion. Let me know what you think. |
It is indeed possible to misuse the mirroring feature which could lead to weird behaviors. However, we think that the majority of users will use the feature as intended. It would be nice if we could do some sort of validation but there are several complications in doing so. Validation of mirrored repository: Checking the presence of dependency: We can always make changes to a feature by the swift evolution process. Let's see the response from users and we can figure out how we can improve it if they do run into weird things. |
rdar://problem/42511642 [SR-8328]: Implement SE-0219 Package Manager Dependency Mirroring
https://bugs.swift.org/browse/SR-8328