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

Expected PURL for swift #53

Closed
ken-duck opened this issue Jan 28, 2019 · 6 comments
Closed

Expected PURL for swift #53

ken-duck opened this issue Jan 28, 2019 · 6 comments

Comments

@ken-duck
Copy link

ken-duck commented Jan 28, 2019

I was trying to identify the expected PURL for swift packages, and was wondering if there was a suggested format.

My first guess is that it is likely similar (but not quite the same as) golang, as it appears that swift packages require both a repository path and a package name. Since a package name is required, I suspect that the repository path is all contained within the namespace.

For example, from the examples on the linked swift package site perhaps we would have:

pkg:swift/github.com/apple/example-package-fisheryates/FisherYates@2.0.0
pkg:swift/github.com/apple/example-package-playingcard/PlayingCard@3.0.0
pkg:swift/github.com/apple/example-package-deckofplayingcards/DeckOfPlayingCards@3.0.0

Note that there is one description of a possible ways to allow multiple swift modules in one repository here. It is not official by any means, from what I can tell, but it appears that it could be supported using the subpath component of PURL.

Does this fulfill the expectations of the PURL for swift?

Thanks

@stevespringett
Copy link
Member

@ken-duck, I think you've interrupted the spec correctly and applied it to swift quite well. @pombredanne This is my thoughts on swift:

swift for Swift packages

There is no default package repository: the namespace is implied from dependencies defined in Packages.swift

  • The namespace and name must be lowercased
  • The subpath is used to point to a subpath inside a package
  • The version is a commit or tag

Examples:

pkg:swift/github.com/apple/example-package-fisheryates/FisherYates@2.0.0
pkg:swift/github.com/apple/example-package-playingcard/PlayingCard@3.0.0
pkg:swift/github.com/apple/example-package-playingcard/PlayingCard@7a47ec16b59e7e39827b65c1eae79d3f32a28116

@jdillon
Copy link

jdillon commented Jan 28, 2019

@stevespringett any reason why The namespace and name must be lowercased ? Seems like many swift packages have a mixed-case name, and even in your examples above you have a mixed-case name.

@stevespringett
Copy link
Member

stevespringett commented Jan 28, 2019

@jdillon I was really hoping this would be pointed out. I wanted to draw attention to the golang requirement that the namespace and name be lowercase since @ken-duck referenced it. In golang, the modules are lowercase, but the examples also point to external sites, like GitHub, similar to how we're doing swift.

I do not think swift should be lowercased due to uncertainty of the target site being referenced in the namespace is case-sensitive or not. For example, Github is case aware, not case sensitive. So case doesn't matter much, but if another provider was referenced, then that provider may be case sensitive.


swift for Swift packages

There is no default package repository: the namespace is implied from dependencies defined in Packages.swift

  • The subpath is used to point to a subpath inside a package
  • The version is a commit or tag

Examples:

pkg:swift/github.com/apple/example-package-fisheryates/FisherYates@2.0.0
pkg:swift/github.com/apple/example-package-playingcard/PlayingCard@3.0.0
pkg:swift/github.com/apple/example-package-playingcard/PlayingCard@7a47ec16b59e7e39827b65c1eae79d3f32a28116

We may want to consider removing this requirement from golang as well.

@jdillon
Copy link

jdillon commented Jan 29, 2019

In terms of DNS names, like github.com only that portion could potentially be considered insensitive, everything else totally depends on the server implementation. Github for example treats these the same:

But another service may not.

I think this again falls into the section of leave it as given; as the more per-type transformations to normalize imply more chances that any given time any "spec compliant impl" may be wrong if some new format gets introduced with new transformation rules.

Related to: #38

I also suggest that if some format has some requirement saying name or namespace is lowercase or uppercase or whatever, that the purl spec shouldn't care about that either; and a user configures a purl for one of those types with invalid case, then the purl just is invalid in terms of that specific ecosytem, but in terms of the general purl specification is valid.

IMO there should be zero type-specific transformations. Only generic applicable to all normalizations. And I think wrt to case, the only field that can be mutated like this is the type. Everything else is going to be very ecosystem specific and IMO its not possible or reasonable to implement a proper spec compliant implementation that could ever be spec-valid with these sorts of transformations.

@ken-duck
Copy link
Author

ken-duck commented Feb 1, 2019

Thanks for the feedback @stevespringett !

@ken-duck
Copy link
Author

My question was answered satisfactorily, and it looks like discussion has ended. Thanks for the help!

fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 18, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it becomes
clear that the repository URL is actually used as the key / identifier,
not the package name (plus maybe with the organization name). Note that
[1] says that "Each dependency specifies a source URL and version
requirements. The source URL is a URL accessible to the current user
that resolves to a Git repository." Furthermore, SPM allows only one
package to be present per repository, which in fact makes the
repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm` integration
currently does works on package granularity only and does not look at
the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog format
for the IDs of packages seems to be a better fit, which also ensures
the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 18, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it
becomes clear that the repository URL is actually used as the key /
identifier, not the package name (plus maybe with the organization
name). Note that [1] says that "Each dependency specifies a source URL
and version requirements. The source URL is a URL accessible to the
current user that resolves to a Git repository." Furthermore, SPM
allows only one package to be present per repository, which in fact
makes the repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm`
integration currently works on package granularity only and does not
look at the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog
format for the IDs of packages seems to be a better fit, which also
ensures the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 18, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it
becomes clear that the repository URL is actually used as the key /
identifier, not the package name (plus maybe the organization name).
Note that [1] says that "Each dependency specifies a source URL and
version requirements. The source URL is a URL accessible to the current
user that resolves to a Git repository." Furthermore, SPM allows only
one package to be present per repository, which in fact makes the
repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm`
integration currently works on package granularity only and does not
look at the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog
format for the IDs of packages seems to be a better fit, which also
ensures the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 18, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it
becomes clear that the repository URL is actually used as the key /
identifier, not the package name (plus maybe the organization name).
Note that [1] says that "Each dependency specifies a source URL and
version requirements. The source URL is a URL accessible to the current
user that resolves to a Git repository." Furthermore, SPM allows only
one package to be present per repository, which in fact makes the
repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm`
integration currently works on package granularity only and does not
look at the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog
format for the IDs of packages seems to be a better fit, which also
ensures the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 18, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it
becomes clear that the repository URL is actually used as the key /
identifier, not the package name (plus maybe the organization name).
Note that [1] says that "Each dependency specifies a source URL and
version requirements. The source URL is a URL accessible to the current
user that resolves to a Git repository." Furthermore, SPM allows only
one package to be present per repository, which in fact makes the
repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm`
integration currently works on package granularity only and does not
look at the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog
format for the IDs of packages seems to be a better fit, which also
ensures the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
fviernau added a commit to oss-review-toolkit/ort that referenced this issue Jan 19, 2024
Previously, tuples of the form `(VCS host organization name, package
name)` have been used. However, such tuples are not guaranteed to be
unique, because the name of the VCS host is not included.

Looking at how dependencies are defined for SPM packages [1], it
becomes clear that the repository URL is actually used as the key /
identifier, not the package name (plus maybe the organization name).
Note that [1] says that "Each dependency specifies a source URL and
version requirements. The source URL is a URL accessible to the current
user that resolves to a Git repository." Furthermore, SPM allows only
one package to be present per repository, which in fact makes the
repository URL a good candidate to be used as ID.

Note that the restriction to one package per repository used to be too
restrictive in some cases which is one reason why the concept of so
called targets [1] has been introduced. However, ORT's `Spm`
integration currently works on package granularity only and does not
look at the more fine grained targets.

The approach to specifying dependencies by their repository is very
similar to the approach Go modules has taken. So, using an analog
format for the IDs of packages seems to be a better fit, which also
ensures the uniqueness of the IDs.

Note also the discussion in [2].

[1] https://www.swift.org/package-manager/
[2] package-url/purl-spec#53

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants