rustPlatform.fetchCargoVendor: allow duplicated dependencies#387337
rustPlatform.fetchCargoVendor: allow duplicated dependencies#387337K900 merged 3 commits intoNixOS:stagingfrom
Conversation
f7be6ba to
27dd560
Compare
|
Should target staging considering the amount of rebuilds |
|
Yes I'll point it there soon, but I still have a few TODOs. |
7a1c9bb to
b0e4125
Compare
b0e4125 to
1cf6ec4
Compare
1cf6ec4 to
242f358
Compare
242f358 to
6899498
Compare
|
Unfortunately, this does not fix the sui problem. I debugged it by adding "set -x" on the cargo-vendor-dir command: The problem is triggered by 2 versions of the tokio-macros used by sui |
|
You are using In this PR I only modified I was able to build sui with this: {
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
zstd,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "sui";
version = "1.43.1";
src = fetchFromGitHub {
owner = "MystenLabs";
repo = "sui";
tag = "mainnet-v${finalAttrs.version}";
hash = "sha256-mNljh3HupusGmfT3pXtjqUp7OZHhyWd6jNiFiKlSYpk=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-ckotvpQw3WfvJ2YXR/XKT7LamGj7kLtGwMR/qrXpmYc=";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
zstd
];
env = {
# if this is not set the build will try to invoke git to get the rev
GIT_REVISION = "nixpkgs@${finalAttrs.version}";
ZSTD_SYS_USE_PKG_CONFIG = true;
};
# the build takes up more than 60G of space even without the checks
# my system ran out of space (150G) when having tests enabled
doCheck = false;
}) |
|
Ahh, I see. I used |
6899498 to
bb8c648
Compare
|
New format: |
There was a problem hiding this comment.
I tested this patch today on a project where it was running into the failed to create symbolic link error and it fixed it successfully.
EDIT: Though I'm now running into an error like this:
error: failed to select a version for the requirement `cfg-if = "^1.0"` (locked to 1.0.0)
Not sure if this is related to the fetching or not
EDIT: forget about it. This seems to be an unrelated issue
If this is a public project, please share a link to it. |
|
@TomaSajt My issue seems to be unrelated. Please don't feel blocked by it |
|
Packaging Kiesel seems to be blocked on this. Kiesel uses an in-tree Rust crate for some FFI, which depends partly on crates.io versions, partly on git versions to get the latest fixes. A lot of transitive deps are duplicated in turn, too. |
MultisampledNight
left a comment
There was a problem hiding this comment.
Simple enough impl, impact is bearable.
| next_registry_ind = 1 | ||
| next_git_ind = 0 | ||
|
|
||
| source_config = {} | ||
|
|
||
| source_config["_vendored-source-registry-0"] = {} | ||
| source_config["_vendored-source-registry-0"]["directory"] = "@vendor@/source-registry-0" | ||
| source_config["crates-io"] = {} | ||
| source_config["crates-io"]["replace-with"] = "_vendored-source-registry-0" |
There was a problem hiding this comment.
Nit: Could maybe refactor this to instead store lists of registry and git sources, then constructing the source_config afterwards. This would avoid bugs due to missing to increment the indices. Works fine as-is though.
|
Pushed a change factoring out some stuff to slightly de-clutter the |
|
What's your opinion on versioning The main advantage of it would be that we can make more frequent changes to the fetcher, because it will only affect packages that opt into an update, rather than (pretty much) all rust packages. For example let's suppose all packages have The downside is adding extra complexity and maintenance burden. |
|
We could have versioning in the future, but this PR currently does not break any hashes. It only breaks an assumption about the final layout of stuff, not the FOD hash. Currently, the place I could imagine versioning being needed is if we start supporting multiple non-git registries and also want to support duplicate packages in there (because we currently just have only one "tarballs" directory in the FOD, unlike with git deps) Be we could still avoid versioning even in that situation by being sneaky and adding special cases. In any case, having this double layered fetcher implementation is very ideal when considering hash stability. The annoying thing for this change specifically would be backporting. |
|
re Backporting: Given that 25.11 is coming up we could "just" do it with the stable bump |
|
Can we land this please. This bug is very annoying for some flakes and clearly wrong behavior on the fetch site. |
Sort Cargo.toml paths by depth/name for traversal. Skip manifests where cargo metadata fails to avoid aborting on invalid or unsupported example crates. Fix mainfest/manifest typo in helper name.
This is achieved by having subdirs in the vendor dir
This is needed because the previous commit moved crates one layer deeper in the vendor directory of rust packages when using fetchCargoVendor
|
@TomaSajt thank you so much - this shit is blocking proper sui packaging for so long. |
|
Holy... this actually got merged. For the record: since this is not exactly backportable (in its current form), packages in stable still need to use the Also, packages that do patching to their lockfiles and also want to backport version updates probably have to carry the patches until 25.11 goes EOL. I can imagine making a followup PR that adds a stable-branch-only flag to the fetcher that could opt in to the new behaviour on stable, too. |
This is a breaking change (even if mostly internal). Because of this, it's not really backportable either.
Reviews are welcome.
Fixes #359340
Fixes #30742
Related:
This PR contains the simpler but arguably more important part of #282798.
The other PR tries to migrate both
importCargoLockandfetchCargoVendor, but this one only does thefetchCargoVendorchange.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.