如何在不使用货物供应商的情况下手动添加离线依赖性项目

发布于 2025-02-11 08:22:01 字数 569 浏览 3 评论 0 原文

我目前正在考虑将Rust集成到我的工作流程中,并且现在遇到了一些问题。这是我的情况:

  1. 我有2个系统,系统A和系统B

  2. B与Internet无连接

  3. B的A和Copy-Pasta事物访问B是生锈的环境,将用于运行Rust和Cargo

  4. a可以访问互联网,但无法运行任何货物/生锈命令

为例,假设我正在制作一个项目,而我依靠Rand 0.8.5板条箱为我的项目。理想情况下,我将使用货物供应商命令脱机依赖性,但由于点2)和4)我不能这样做。 但无法弄清楚如何做:

此外,这

是我认为我需要做的 兰德(Rand)从B中的A下载到供应商,但是……

因为GitHub上的Rand存储库在使用货物供应商的列兰特时与文件夹层次结构不匹配,所以当我将rand下载的副本放到供应商时,我会遇到错误。此外,我希望是否有人知道如何轻松使兰特存储库工作(不,“只匹配文件层次结构”不是我想要的答案能够成功运营货物供应商)或知道我是否没有正确地做某事。我了解我的情况特别不寻常,因此请随时要求任何澄清。谢谢!

I am currently looking into integrating Rust into my workflow and am running into a bit of an issue right now. This is my situation:

  1. I have 2 systems, system A and system B

  2. B has no connection to the internet but I can access B through A and copy-pasta things from A to B

  3. B is the environment for Rust and will be used for running Rust and Cargo

  4. A has access to the internet but cannot run any Cargo/Rust commands

As an example, let’s say I am making a project where I depend on the rand 0.8.5 crate for my project. Ideally I would use the cargo vendor command to offline the dependency but because of points 2) and 4) I cannot do that. Moreover, this is what I think I need to do but cannot figure out how to do it:

A) download the rand repository from GitHub on A

B) manually make a .cargo/config.toml and vendor/ on B

C) copy pasta rand download from A to vendor in B BUT…

Because the rand repository on GitHub doesn’t match with the folder hierarchy when off-lining rand using cargo vendor, I get errors when I do a copy of the rand download to vendor. Moreover, I was hoping if anyone knows how to easily get the rand repository to work (no, “ just match the file hierarchy” isn’t the answer I am looking for as I would not know what the hierarchy should be like due to not being able to successfully run cargo vendor) or know if I am not doing something correctly. I understand my situation is particularly unusual so please feel free to ask for any clarification. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぶ宁プ宁ぶ 2025-02-18 08:22:01

您可以使用货物获取和预取

下载板条箱以供离线使用..

// Install cargo prefetch

$ cargo install cargo-prefetch

cargo prefetch

然后尝试将文件从a到b,然后

看看这些用于配置的文件:

.crates.toml
.crates2.json

You can use cargo fetch and prefetch

For downloading crates for offline use..

// Install cargo prefetch

$ cargo install cargo-prefetch

Cargo fetch

Cargo prefetch

Then Try moving the files from A to B

Take a look at these files for configuration:

.crates.toml
.crates2.json
高跟鞋的旋律 2025-02-18 08:22:01

我想我想了!

首先,我从github下载兰德,然后将其从A到B,然后将其移至货物中


rand = {path =“路径/to/rand/github/download”}}}}

实际上仍然不起作用,并且会引起问题,并且依赖关系具有依赖关系,值得庆幸的是,编译器告诉您需要什么,因此与其他人是相同的过程除了需要调整以外的货物。终于使用货物运行 - Offline和Boom Sauce,它有效

I think I figured it out!

First I download rand off of GitHub and move it from A to B and then in Cargo.toml I do the following:

[dependencies]
rand = { path = “path/to/rand/GitHub/download” }

This actually will still not work and will cause issues and turns out dependencies have dependencies and thankfully the compiler tells you what is needed so it’s the same process with those other ones except adjustments are needed to be done to the Cargo.toml for the dependency (rand in this example). Finally use cargo run —offline and boom sauce, it works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文