Skip to content

rustPlatform.fetchCargoVendor: fetch git submodules#356415

Merged
TomaSajt merged 2 commits intoNixOS:masterfrom
TomaSajt:fetch-cargo-vendor-submodules
Nov 16, 2024
Merged

rustPlatform.fetchCargoVendor: fetch git submodules#356415
TomaSajt merged 2 commits intoNixOS:masterfrom
TomaSajt:fetch-cargo-vendor-submodules

Conversation

@TomaSajt
Copy link
Contributor

@TomaSajt TomaSajt commented Nov 16, 2024

Related PR, where this issue was discovered: #356385

Looks like I missed that fetchgit has fetchSubmodules set to true by default, so when I was copying the importCargoLock implementation, I did not also fetch the submodules like (it turns out) it did.

fetchgit defaults:

{ url, rev ? "HEAD", leaveDotGit ? deepClone
, outputHash ? lib.fakeHash, outputHashAlgo ? null
, fetchSubmodules ? true, deepClone ? false
, branchName ? null
, sparseCheckout ? []
, nonConeMode ? false
, name ? urlToName url rev
, # Shell code executed after the file has been fetched
# successfully. This can do things like check or transform the file.
postFetch ? ""
, preferLocalBuild ? true
, fetchLFS ? false
, # Shell code to build a netrc file for BASIC auth
netrcPhase ? null
, # Impure env vars (https://nixos.org/nix/manual/#sec-advanced-attributes)
# needed for netrcPhase
netrcImpureEnvVars ? []
, meta ? {}
, allowedRequisites ? null
}:

importCargoLock calling fetchgit:
fetchgit {
inherit (gitParts) url;
rev = gitParts.sha; # The commit SHA is always available.
sha256 = gitShaOutputHash.${gitParts.sha};
}

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Nov 16, 2024
@nix-owners nix-owners bot requested review from figsoda, winterqt and zowoq November 16, 2024 09:22
@TomaSajt TomaSajt force-pushed the fetch-cargo-vendor-submodules branch from 0b7b447 to 58e265d Compare November 16, 2024 09:25
Copy link
Member

@JohnRTitor JohnRTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run a nixpkgs-review on this to see if the other packages using this fetcher have their hash changed?

@TomaSajt
Copy link
Contributor Author

TomaSajt commented Nov 16, 2024

Checked all other uses of fetchCargoVendor:

nix-build --check -A cargo-shuttle.cargoDeps.vendorStaging -A hieroglyphic.cargoDeps.vendorStaging -A popsicle.cargoDeps.vendorStaging -A python312Packages.json-stream-rs-tokenizer.cargoDeps.vendorStaging

and their hash didn't change, so it seems like they don't use submodules

@TomaSajt
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 356415


x86_64-linux

✅ 14 packages built:
  • cargo-shuttle
  • cosmic-applets
  • hieroglyphic
  • mitmproxy2swagger
  • mitmproxy2swagger.dist
  • popsicle
  • python311Packages.json-stream
  • python311Packages.json-stream-rs-tokenizer
  • python311Packages.json-stream-rs-tokenizer.dist
  • python311Packages.json-stream.dist
  • python312Packages.json-stream
  • python312Packages.json-stream-rs-tokenizer
  • python312Packages.json-stream-rs-tokenizer.dist
  • python312Packages.json-stream.dist

@JohnRTitor
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 356415


x86_64-linux

✅ 14 packages built:
  • cargo-shuttle
  • cosmic-applets
  • hieroglyphic
  • mitmproxy2swagger
  • mitmproxy2swagger.dist
  • popsicle
  • python311Packages.json-stream
  • python311Packages.json-stream-rs-tokenizer
  • python311Packages.json-stream-rs-tokenizer.dist
  • python311Packages.json-stream.dist
  • python312Packages.json-stream
  • python312Packages.json-stream-rs-tokenizer
  • python312Packages.json-stream-rs-tokenizer.dist
  • python312Packages.json-stream.dist

@JohnRTitor
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 356415


aarch64-darwin

✅ 12 packages built:
  • cargo-shuttle
  • hieroglyphic
  • mitmproxy2swagger
  • mitmproxy2swagger.dist
  • python311Packages.json-stream
  • python311Packages.json-stream-rs-tokenizer
  • python311Packages.json-stream-rs-tokenizer.dist
  • python311Packages.json-stream.dist
  • python312Packages.json-stream
  • python312Packages.json-stream-rs-tokenizer
  • python312Packages.json-stream-rs-tokenizer.dist
  • python312Packages.json-stream.dist

@TomaSajt
Copy link
Contributor Author

I'll merge this in an hour.

@TomaSajt TomaSajt merged commit 69b3019 into NixOS:master Nov 16, 2024
@JohnRTitor
Copy link
Member

Sure, I was just waiting for eval.

@kachick kachick mentioned this pull request Nov 19, 2024
13 tasks
@JohnRTitor JohnRTitor added the 8.has: port to stable This PR already has a backport to the stable release. label Dec 6, 2024
@TomaSajt TomaSajt deleted the fetch-cargo-vendor-submodules branch June 19, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 8.has: port to stable This PR already has a backport to the stable release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants