Skip to content
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

[SR-679] swiftpm should support rewriting dependent package urls for vendoring #5400

Open
swift-ci opened this issue Feb 5, 2016 · 6 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2016

Previous ID SR-679
Radar rdar://problem/28895755
Original Reporter jaybuff (JIRA User)
Type New Feature
Status Reopened
Resolution
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels New Feature
Assignee None
Priority

md5: 2a3c7f12451e616747e3dc55507e86d4

relates to:

  • SR-1168 Deal with dependency name collisions

Issue Description:

We would like a method to munge dependency urls for a number of reasons. We want to "vendor" dependencies. Vendoring would give us a number of benefits:

  1. integrity - no one would be able to change a tag out from under us

  2. customization - place to put custom patches

  3. availability - we don't have to depend on uptime of an external system

I imagine a hook that we could register in the top Package.swift that would have a signature like this:

mungeDependency(originalUrl: String, originalVersion: Version) -> (newUrl: String, newVersion: Version)

This is partially related to the "scheme" problem where the user running swift build rather than the developer writing Package.swift should be controlling if the git clone is happening using the https or git protocol.

@rballard
Copy link
Contributor

Max and I have been discussing using the upcoming lockfiles proposal as a way to support this, rather than supporting it directly in the Package.swift.

@swift-ci
Copy link
Contributor Author

Comment by Ramon Nogueira (JIRA)

It doesn't seem appropriate to put this in lock files. Lock files are generated by a tool when updating dependencies, while this would be a per-project configuration that would be hand-written.

In the code above, I don't see how this could be used to support vendoring. My understanding is that vendoring (usually) means that the sources for a given dependency are checked in to your repository (or are submodules). In this case, there is no version, we just need to point spm directly at the checked-out copy. It seems to me that what we really want is to replace wholesale the mapping

func findDependency(package: Package) throws -> File

@swift-ci
Copy link
Contributor Author

Comment by Jay Buffington (JIRA)

I recently discovered this git config option that may be relevant here:

url.<base>.insteadOf
Any URL that starts with this value will be rewritten to start, instead, with <base>. In cases where some site serves a large number of repositories, and serves them with multiple access methods, and some users need to use different access methods, this feature allows people to specify any of the equivalent URLs and have Git automatically rewrite the URL to the best alternative for the particular user, even for a never-before-seen repository on the site. When more than one insteadOf strings match a given URL, the longest match is used.

@weissi
Copy link
Member

weissi commented Jun 2, 2020

@aciidb0mb3r/ @neonichu isn't this done with the mirroring support?

@swift-ci
Copy link
Contributor Author

Comment by Mustafa YALCIN (JIRA)

3

1 similar comment
@swift-ci
Copy link
Contributor Author

Comment by Mustafa YALCIN (JIRA)

3

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants