python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / rure / update.sh
blob6e85d7cf03a73f9e23dd70856f411dbbd53e5684
1 #!/usr/bin/env nix-shell
2 #! nix-shell -p nix jq curl cargo rsync
3 #! nix-shell -i bash
5 set -eu
7 cd "$(dirname "$0")"
9 crate=rure
11 echo "Getting latest version from crates.io API" >&2
13 curlOpts=(
14 -H "Accept: application/json"
15 -H "User-Agent: $crate update script (https://github.com/nixos/nixpkgs/)"
18 version="$(curl "${curlOpts[@]}" "https://crates.io/api/v1/crates/$crate" \
19 | jq -r .crate.max_stable_version)"
21 echo "Prefetching latest tarball from crates.io" >&2
23 url="https://crates.io/api/v1/crates/$crate/$version/download"
24 prefetch="$(nix-prefetch-url --print-path --type sha256 --unpack "$url")"
26 cat > pin.json <<EOF
28 "pname": "$crate",
29 "version": "$version",
30 "sha256": "$(printf '%s' "$prefetch" | head -n1)"
32 EOF
34 echo "Generating updated Cargo.lock" >&2
36 tmp="$(mktemp -d)"
38 cleanup() {
39 echo "Removing $tmp" >&2
40 rm -rf "$tmp"
43 trap cleanup EXIT
45 rsync -a --chmod=ugo=rwX "$(printf '%s' "$prefetch" | tail -n1)/" "$tmp"
47 pushd "$tmp"
48 cargo update
49 popd
51 cp "$tmp/Cargo.lock" ./Cargo.lock