Commit a7f22e88 authored by Francis Gagné's avatar Francis Gagné Committed by Masum Reza
Browse files

vscode-extensions.vadimcn.vscode-lldb: Fix update.sh

- Fix nix-shell invocation (`-p packages` and `path` are mutually
  exclusive)
- Patch hashes in the correct files
- Use nurl instead of nix-prefetch (the latter currently fails due to
  <https://github.com/msteen/nix-prefetch/issues/54>)
- Update GitHub repo name

Fixes #204311
parent c612142e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
{
  pkgs ? import ../../../../../.. { },
}:

# Ideally, pkgs points to default.nix file of Nixpkgs official tree
with pkgs;

mkShell {
  inputsFrom = [
    (import ../../update-shell.nix { inherit pkgs; })
  ];
  packages = [
    nix-prefetch-github
    nurl
    prefetch-npm-deps
  ];
}
+8 −6
Original line number Diff line number Diff line
#! /usr/bin/env nix-shell
#! nix-shell ../../update-shell.nix -i bash -p nix-prefetch-github prefetch-npm-deps
#! nix-shell update-shell.nix -i bash

set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
@@ -12,8 +12,10 @@ of https://github.com/vadimcn/llvm-project and update lldb with correct version
# Ideally, nixpkgs points to default.nix file of Nixpkgs official tree
nixpkgs=../../../../../..
nixFile=./default.nix
adapterNixFile=./adapter.nix
nodeDepsNixFile=./node_deps.nix
owner=vadimcn
repo=vscode-lldb
repo=codelldb
version="$1"
if [[ $# -ne 1 ]]; then
    # no version specified, find the newest one
@@ -34,14 +36,14 @@ echo "$old_version -> $version"

# update hashes
sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile"
srcHash=$(nix-prefetch-github vadimcn vscode-lldb --rev "v$version" | jq --raw-output .hash)
srcHash=$(nix-prefetch-github vadimcn codelldb --rev "v$version" | jq --raw-output .hash)
sed -E 's#\bhash = ".*?"#hash = "'$srcHash'"#' --in-place "$nixFile"
cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
sed -E 's#\bcargoHash = ".*?"#cargoHash = "'$cargoHash'"#' --in-place "$nixFile"
cargoHash=$(nurl --expr "(import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.vendorStaging")
sed -E 's#\bcargoHash = ".*?"#cargoHash = "'$cargoHash'"#' --in-place "$adapterNixFile"

pushd $TMPDIR
curl -LO https://raw.githubusercontent.com/$owner/$repo/v${version}/package-lock.json
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
popd
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'$npmDepsHash'"#' --in-place "$nixFile"
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'$npmDepsHash'"#' --in-place "$nodeDepsNixFile"