go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.45k stars 5.43k forks source link

cargo registry - Renamed dependencies does not get renamed #31500

Open usbalbin opened 3 months ago

usbalbin commented 3 months ago

Description

When publishing a crate with a renamed dependency

# Cargo.toml

[package]
name = "rename_deps"
version = "0.1.2"
edition = "2021"
publish = ["gitea"]

[dependencies]
embedded-hal-0-2 = { package = "embedded-hal", version = "0.2.7" } # <-- embedded-hal renamed to embedded-hal-0-2

The registry does not reflect the fact that the dependency is renamed https://my-gitea-domain/api/packages/SomeOwner/cargo/re/na/rename_deps:

{"name":"rename_deps","vers":"0.1.2","deps":[{"name":"embedded-hal","req":"^0.2.7","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal","registry":"https://github.com/rust-lang/crates.io-index","package":null}],"cksum":"5a4e09f3752e42de84106f0f3b3e219eb553c78ade6ba0f4473fd5b744d18572","features":{},"yanked":false}

Same thing formatted:

{
    "name": "rename_deps",
    "vers": "0.1.2",
    "deps": [
        {
            "name": "embedded-hal", // <-- Should have been my new name?
            "req": "^0.2.7",
            "features": [],
            "optional": false,
            "default_features": true,
            "target": null,
            "kind": "normal",
            "registry": "https://github.com/rust-lang/crates.io-index",
            "package": null // <-- Should be "embedded-hal"?
        }
    ],
    "cksum": "5a4e09f3752e42de84106f0f3b3e219eb553c78ade6ba0f4473fd5b744d18572",
    "features": {},
    "yanked": false
}

I posted the same issue in rust-lang/cargo#14148 leading me here. I have not tried this on demo.gitea.com

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

Whatever is in the docker image

Operating System

Debian 12

How are you running Gitea?

Database

MySQL/MariaDB

techknowlogick commented 3 months ago

Thanks @usbalbin, has this been working previously, or has it always been like this? (If you haven’t tried this before and don’t know that’s ok)

usbalbin commented 3 months ago

I first tried the same thing with 1.21.something (can probably look up the patch version if needed) but it did not work either

KN4CK3R commented 3 months ago

@techknowlogick That's not implemented. I didn't know that was possible. I will send a PR when I got time for it.

usbalbin commented 2 months ago

I have found another issue. Not sure if it is gitea or cargo. In case it is related https://forum.gitea.com/t/published-cargo-crate-version-not-available/9365