Merge pull request #119211 from Riey/rust-analyzer

rust-analyzer: 2021-04-05 -> 2021-04-12
This commit is contained in:
Sandro 2021-04-13 01:33:28 +02:00 committed by GitHub
commit b493a8feb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 19 deletions

View file

@ -4,20 +4,16 @@
, doCheck ? true
}:
let
rev = "2021-04-05";
in
rustPlatform.buildRustPackage {
rustPlatform.buildRustPackage rec {
pname = "rust-analyzer-unwrapped";
version = "unstable-${rev}";
cargoSha256 = "sha256-kDwdKa08E0h24lOOa7ALeNqHlMjMry/ru1qwCIyKmuE=";
version = "2021-04-12";
cargoSha256 = "1mnx0mnfkvz6gmzy2jcl0wrdwd1mgfnrny4xf9wkd5vd4ks4k338";
src = fetchFromGitHub {
owner = "rust-analyzer";
repo = "rust-analyzer";
inherit rev;
sha256 = "sha256-ZDxy87F3uz8bTF1/2LIy5r4Nv/M3xe97F7mwJNEFcUs=";
rev = version;
sha256 = "1rg20aswbh9palwr3qfcnscsvzmbmhghn4k0nl11m9j7z6hva6bg";
};
buildAndTestSubdir = "crates/rust-analyzer";
@ -31,7 +27,7 @@ rustPlatform.buildRustPackage {
libiconv
];
RUST_ANALYZER_REV = rev;
RUST_ANALYZER_REV = version;
inherit doCheck;
preCheck = lib.optionalString doCheck ''
@ -43,7 +39,7 @@ rustPlatform.buildRustPackage {
runHook preInstallCheck
versionOutput="$($out/bin/rust-analyzer --version)"
echo "'rust-analyzer --version' returns: $versionOutput"
[[ "$versionOutput" == "rust-analyzer ${rev}" ]]
[[ "$versionOutput" == "rust-analyzer ${version}" ]]
runHook postInstallCheck
'';

View file

@ -8,23 +8,23 @@ nixpkgs=../../../../..
# Update lsp
rev=$(
ver=$(
curl -s "https://api.github.com/repos/$owner/$repo/releases" |
jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output
)
old_rev=$(sed -nE 's/.*\brev = "(.*)".*/\1/p' ./default.nix)
old_ver=$(sed -nE 's/.*\bversion = "(.*)".*/\1/p' ./default.nix)
if grep -q 'cargoSha256 = ""' ./default.nix; then
old_rev='broken'
old_ver='broken'
fi
if [[ "$rev" == "$old_rev" ]]; then
echo "Up to date: $rev"
if [[ "$ver" == "$old_ver" ]]; then
echo "Up to date: $ver"
exit
fi
echo "$old_rev -> $rev"
echo "$old_ver -> $ver"
sha256=$(nix-prefetch -f "$nixpkgs" rust-analyzer-unwrapped.src --rev "$rev")
sha256=$(nix-prefetch -f "$nixpkgs" rust-analyzer-unwrapped.src --rev "$ver")
# Clear cargoSha256 to avoid inconsistency.
sed -e "s#rev = \".*\"#rev = \"$rev\"#" \
sed -e "s#version = \".*\"#version = \"$ver\"#" \
-e "/fetchFromGitHub/,/}/ s#sha256 = \".*\"#sha256 = \"$sha256\"#" \
-e "s#cargoSha256 = \".*\"#cargoSha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"#" \
--in-place ./default.nix