obs-service-cargo icon indicating copy to clipboard operation
obs-service-cargo copied to clipboard

Vendoring from git sources

Open xTeixeira opened this issue 2 years ago • 7 comments

I'm trying to package amdgpu_top, which includes a dependency with a git source in Cargo.toml / Cargo.lock:

[[package]]
name = "libdrm_amdgpu_sys"
version = "0.7.3"
source = "git+https://github.com/Umio-Yasuno/libdrm-amdgpu-sys-rs#b5e281176c6ba5c15379b2bb832d1b37e83e673f"
dependencies = [
 "libc",
]
[dependencies]
...
libdrm_amdgpu_sys = { version = "0.7.3", git = "https://github.com/Umio-Yasuno/libdrm-amdgpu-sys-rs" }

When building the package, I get errors from this dependency:

[  199s] error: failed to compile `amdgpu_top v0.8.5 (/home/abuild/rpmbuild/BUILD/amdgpu_top-0.8.5)`, intermediate artifacts can be found at `/home/abuild/rpmbuild/BUILD/amdgpu_top-0.8.5/target`.
[  199s] To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
[  199s] 
[  199s] Caused by:
[  199s]   failed to get `libdrm_amdgpu_sys` as a dependency of package `libamdgpu_top v0.8.5 (/home/abuild/rpmbuild/BUILD/amdgpu_top-0.8.5/crates/libamdgpu_top)`
[  199s]       ... which satisfies path dependency `libamdgpu_top` of package `amdgpu_top v0.8.5 (/home/abuild/rpmbuild/BUILD/amdgpu_top-0.8.5)`
[  199s] 
[  199s] Caused by:
[  199s]   failed to load source for dependency `libdrm_amdgpu_sys`
[  199s] 
[  199s] Caused by:
[  199s]   Unable to update https://github.com/Umio-Yasuno/libdrm-amdgpu-sys-rs
[  199s] 
[  199s] Caused by:
[  199s]   the source git+https://github.com/Umio-Yasuno/libdrm-amdgpu-sys-rs requires a lock file to be present first before it can be
[  199s]   used against vendored source code
[  199s] 
[  199s]   remove the source replacement configuration, generate a lock file, and then
[  199s]   restore the source replacement configuration to continue the build

If I change it to pull the same dependency from crates.io instead of a git source, the build works. Does this service not support pulling from git sources? Any good way to work around this?

xTeixeira avatar Jun 14 '24 15:06 xTeixeira

What OBS project is this in? It would be good to check our your .spec and _service file too.

Firstyear avatar Jun 17 '24 05:06 Firstyear

Here.

Right now I have it patched to pull the libdrm_amdgpu_sys dependency from crates.io instead of github. If you need to reproduce the error you'll need to remove the patch and regenerate the vendor tarball.

xTeixeira avatar Jun 21 '24 16:06 xTeixeira

weird bug. i haven't experienced this so far. But i believe we already brought a fix because i see the error message from yours

[  199s]   remove the source replacement configuration, generate a lock file, and then
[  199s]   restore the source replacement configuration to continue the build

very sorry for late response

uncomfyhalomacro avatar Jul 16 '24 14:07 uncomfyhalomacro

@uncomfyhalomacro But it should be able to vendor git sources, I've done it with Kanidm in the past. I think the problem is " false" should be true?

Firstyear avatar Jul 17 '24 00:07 Firstyear

interesting. i haven't investigated this yet. I will attempt to reproduce

uncomfyhalomacro avatar Jul 18 '24 12:07 uncomfyhalomacro

Closing as this is an issue with cargo install and not ours. For workspace configurations, use install instead of the cargo install command

uncomfyhalomacro avatar Jul 19 '24 01:07 uncomfyhalomacro

I have to document this. Weird stuff

uncomfyhalomacro avatar Jul 19 '24 01:07 uncomfyhalomacro