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

Automated updates for buildRustPackage Applications #156

Merged
merged 1 commit into from Mar 5, 2020

Conversation

bhipple
Copy link
Collaborator

@bhipple bhipple commented Feb 23, 2020

Adds our first non-trivial rewriter that makes real updates!

src/Rewrite.hs Show resolved Hide resolved
src/Rewrite.hs Show resolved Hide resolved
@bhipple bhipple force-pushed the feature/rust-update branch 2 times, most recently from 2d8a696 to b5d6a3a Compare March 5, 2020 06:01
@bhipple bhipple changed the title [WIP] Automated updates for Rust packages, along with legacy cargo fe… Automated updates for buildRustPackage Applications Mar 5, 2020
@bhipple bhipple marked this pull request as ready for review March 5, 2020 06:04
@bhipple
Copy link
Collaborator Author

bhipple commented Mar 5, 2020

So far I have tested this by:

numberOfHashes :: Text -> Int
numberOfHashes derivationContents = countUp "sha256 =" + countUp "sha256="
numberOfHashes derivationContents =
sum $ map countUp ["sha256 =", "sha256=", "cargoSha256 =", "modSha256 ="]
where
countUp x = T.count x derivationContents
Copy link
Collaborator Author

@bhipple bhipple Mar 5, 2020

Choose a reason for hiding this comment

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

It'd be nice to get something that isn't a heuristic here; without my update, the regular version updater will kick and do a half-baked job on the Rust upgrade, since it thinks it just has 1 hash. This fixes it by teaching it about cargoSha256, and while I'm here adding modSha256 (the Go equivalent).

I haven't seen examples in the wild without the space before =, though it'd be nice if everything were hosed down with nixpkgs-fmt so that were an actual robust assumption.

@ryantm ryantm merged commit a8f095a into nix-community:master Mar 5, 2020
@bhipple bhipple deleted the feature/rust-update branch March 7, 2020 21:31
bhipple added a commit to bhipple/nixpkgs-update that referenced this pull request Mar 13, 2020
Having merged an update to make go packages passthru the `modSha256` [1], we can
now have `nixpkgs-update` inspect it and make updates, just as it now does for
Rust packages as of [2].

As a slight detail, because the attribute is in `passthru` rather than actually
being available in the derivation, we just do the equivalent of
`nix eval -f . <attrPath>.<attr>` rather than going through the `drvAttrs` as before.

[1] NixOS/nixpkgs#82027
[2] nix-community#156
bhipple added a commit to bhipple/nixpkgs-update that referenced this pull request Mar 13, 2020
Having merged an update to make go packages passthru the `modSha256` [1], we can
now have `nixpkgs-update` inspect it and make updates, just as it now does for
Rust packages as of [2].

As a slight detail, because the attribute is in `passthru` rather than actually
being available in the derivation, we just do the equivalent of
`nix eval -f . <attrPath>.<attr>` rather than going through the `drvAttrs` as before.

This version has been tested successfully with at least one go update [3], but
not thoroughly vetted. That said, it's essentially identical to the Rust
implementation that has been working well for some time now.

[1] NixOS/nixpkgs#82027
[2] nix-community#156
[3] NixOS/nixpkgs#82465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants