Skip to content
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

rustPlatform.fetchCargoVendor: fetch git submodules #356415

Merged
merged 2 commits into from
Nov 16, 2024

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.

Sorry, something went wrong.

@TomaSajt TomaSajt force-pushed the fetch-cargo-vendor-submodules branch from 0b7b447 to 58e265d Compare November 16, 2024 09:25
Copy link
Contributor

@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
Contributor

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
Contributor

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
20 of 21 checks passed
@JohnRTitor
Copy link
Contributor

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 A PR already has a backport to the stable release. label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: rust 8.has: port to stable A PR already has a backport to the stable release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants