mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
cargo registry - respect renamed dependencies (#32430)
rust allows renaming dependencies such as when depending on multiple versions of the same package. This is not supported by gitea as discovered in #31500 . This PR tries to address that. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -136,8 +136,16 @@ func parsePackage(r io.Reader) (*Package, error) {
|
||||
|
||||
dependencies := make([]*Dependency, 0, len(meta.Deps))
|
||||
for _, dep := range meta.Deps {
|
||||
// https://doc.rust-lang.org/cargo/reference/registry-web-api.html#publish
|
||||
// It is a string of the new package name if the dependency is renamed, otherwise empty
|
||||
name := dep.ExplicitNameInToml
|
||||
pkg := &dep.Name
|
||||
if name == "" {
|
||||
name = dep.Name
|
||||
pkg = nil
|
||||
}
|
||||
dependencies = append(dependencies, &Dependency{
|
||||
Name: dep.Name,
|
||||
Name: name,
|
||||
Req: dep.VersionReq,
|
||||
Features: dep.Features,
|
||||
Optional: dep.Optional,
|
||||
@@ -145,6 +153,7 @@ func parsePackage(r io.Reader) (*Package, error) {
|
||||
Target: dep.Target,
|
||||
Kind: dep.Kind,
|
||||
Registry: dep.Registry,
|
||||
Package: pkg,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user