Skip to content

Support path dependencies for Cargo.toml patches in vendor mode #3241

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

Closed
jayzhuang opened this issue Feb 6, 2025 · 3 comments
Closed

Support path dependencies for Cargo.toml patches in vendor mode #3241

jayzhuang opened this issue Feb 6, 2025 · 3 comments

Comments

@jayzhuang
Copy link
Contributor

I tried running crate_universe from 0.56.0, which includes #3025 in Fuchsia's build, I saw the following error when generating build files:

Error: Failed to get crate from cache for Package { name: Name("askama"), version: Version { major: 0, minor: 12, patch: 1 }, source: Some(SourceId { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")), port: None, path: "/rust-lang/crates.io-index", query: None, fragment: None }, kind: Registry, precise: Some("locked"), name: None }), checksum: Some(Sha256(b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28)), dependencies: [Dependency { name: Name("askama_derive"), version: Version { major: 0, minor: 12, patch: 5 }, source: None }, Dependency { name: Name("askama_escape"), version: Version { major: 0, minor: 10, patch: 3 }, source: Some(SourceId { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")), port: None, path: "/rust-lang/crates.io-index", query: None, fragment: None }, kind: Registry, precise: Some("locked"), name: None }) }], replace: None }

Caused by:
    No such file or directory (os error 2)

For askama, we have the following entry in our Cargo.toml (this is the full file if it helps):

askama = { version = "0.12.1", default-features = false, features = ["config"] }

This is the crate_vendor Bazel target I'm using:

crates_vendor(
    name = "crates_vendor",
    bazel = "//:bazel",
    buildifier = "//:buildifier",
    cargo_lockfile = "//:third_party/rust_crates/Cargo.lock",
    manifests = ["//:third_party/rust_crates/Cargo.toml"],
    mode = "local",
    render_config = render_config(
        generate_rules_license_metadata = True,
    ),
    supported_platform_triples = [
        "x86_64-unknown-linux-gnu",
    ],
    vendor_path = "third_party/rust_crates/vendor",
)

(Some relevant discussions in #3071)

@UebelAndre
Copy link
Collaborator

I believe the root cause is frewsxcv/rust-crates-index#182. The error looks similar to what I saw on #3179 (comment). I haven't had time to put up a pull-request for that change to crates-index, help would be greatly appreciated!

@jayzhuang
Copy link
Contributor Author

jayzhuang commented Feb 10, 2025

Following suggestion from @illicitonion in #3071, I tried running with an older toolchain (1.83.0), and am getting a different error (with rules_rust version 0.56.0:

...
thread 'main' panicked at src/utils.rs:51:18:
Could not rename paths: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
...

@jayzhuang
Copy link
Contributor Author

Hey @illicitonion , I got PR #3274, it works for my use case. PTAL.

github-merge-queue bot pushed a commit that referenced this issue Mar 10, 2025
Support `path` patches in Cargo.toml in `crate_vendor`. See #3241
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