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

cargo-flash: init at 0.8.0 #86221

Closed
wants to merge 2 commits into from
Closed

cargo-flash: init at 0.8.0 #86221

wants to merge 2 commits into from

Conversation

wucke13
Copy link
Contributor

@wucke13 wucke13 commented Apr 28, 2020

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@wucke13
Copy link
Contributor Author

wucke13 commented Apr 28, 2020

@GrahamcOfBorg build cargo-flash

Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Looks good to me in general! Left some nitpicky comments, sorry :)

Comment on lines 7 to 807
[[package]]
name = "gdb-server"
-version = "0.6.0"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6e7b1809fa47255da438a2bddec1ec92e8d35628877c4dc24b44c86c3ba64f7"
dependencies = [
"async-std",
"futures",
@@ -955,7 +957,9 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"

[[package]]
name = "probe-rs"
-version = "0.6.0"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4508248f016eb7f7a50751b9c3e8f9e25add169feac006aef5115dbb5e42be"
dependencies = [
"base64",
"bitfield",
Copy link
Member

Choose a reason for hiding this comment

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

These dependency versions are pinned precisely in the upstream Cargo.toml; if there's fixes from the new versions that are important to pick up, it would probably be a good idea to send a PR bumping the Cargo.{toml,lock} upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I guess they do this on purpose, to keep the version in sync. However, the build breaks without this. What do we do here?

Copy link
Member

Choose a reason for hiding this comment

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

Huh, that build error is really strange; for some reason cargo is insistent on updating probe-rs to a version that isn't what the Cargo.toml specifies, even though the versions specified aren't yanked or anything.

I think patching the lock file is reasonable for now, but bumping the versions evidently fixes things for users (us!) in practice, it'd be nice if the cargo-flash upstream could tag a new release with them.

Copy link
Contributor Author

@wucke13 wucke13 May 3, 2020

Choose a reason for hiding this comment

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

cargo is insistent on updating probe-rs to a version that isn't what the Cargo.toml specifies

A few days ago I heard about this behavior to be intentional, cargo updates dependencies sometimes even if passed the --frozen argument and a Cargo.lock. The docs for --frozen state this (which implicitly explains the observation):

Either of these flags requires that the Cargo.lock file is up-to-date. If the lock file is missing, or it needs to be updated, Cargo will exit with an error.

pkgs/development/tools/rust/cargo-flash/default.nix Outdated Show resolved Hide resolved
@emilazy
Copy link
Member

emilazy commented Apr 28, 2020

@GrahamcOfBorg build cargo-flash

@emilazy
Copy link
Member

emilazy commented Apr 28, 2020

@GrahamcOfBorg build cargo-flash

src = fetchFromGitHub {
owner = "probe-rs";
repo = pname;
rev = "v" + version;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change:

Suggested change
rev = "v" + version;
rev = "v${version}";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC I once got the feedback to do the swap the other way round, as string interpolation is supposed to be more expensive than string concatenation. Is that wrong? I'm eager to know any rational to promote either the one or the other style.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it has much to do with speed, rather consistency and just the code being prettier. Reading the rev takes almost no time anyway, that doesn't really matter.

There's 9 instances of rev = "v" + version; being used throughout the codebase, versus the 1957 instances of rev = "v${version}";. For consistency's sake thats much better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whatever 😆

Copy link
Member

Choose a reason for hiding this comment

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

maybe also this? :D


meta = with stdenv.lib; {
description = "A cargo subcommand to flash ELF binaries onto ARM chips";
homepage = "https://github.com/probe-rs/" + pname;
Copy link
Member

Choose a reason for hiding this comment

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

A copy-pastable URL is probably better:

Suggested change
homepage = "https://github.com/probe-rs/" + pname;
homepage = "https://github.com/probe-rs/cargo-flash";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmh, sure

Copy link
Member

Choose a reason for hiding this comment

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

said yes, didn't do it :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe now?

@wucke13 wucke13 force-pushed the cargo-flash branch 2 times, most recently from 296f2a1 to 48574fe Compare May 23, 2020 13:35
@wucke13
Copy link
Contributor Author

wucke13 commented May 23, 2020

@GrahamcOfBorg build cargo-flash

@wucke13 wucke13 changed the title cargo-flash: init at 0.6.0 cargo-flash: init at 0.8.0 Jul 7, 2020
@wucke13
Copy link
Contributor Author

wucke13 commented Jul 7, 2020

@GrahamcOfBorg build cargo-flash

@Lassulus
Copy link
Member

needs a rebase

@wucke13
Copy link
Contributor Author

wucke13 commented Aug 26, 2020

@Lassulus Thanks, done!

@Lassulus
Copy link
Member

superseded by #96164

@Lassulus Lassulus closed this Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants