summary refs log tree commit diff
path: root/pkgs/development/web/deno/update/librusty_v8.ts
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/web/deno/update/librusty_v8.ts')
-rw-r--r--pkgs/development/web/deno/update/librusty_v8.ts26
1 files changed, 11 insertions, 15 deletions
diff --git a/pkgs/development/web/deno/update/librusty_v8.ts b/pkgs/development/web/deno/update/librusty_v8.ts
index d9d57d2908d..39831f6ea27 100644
--- a/pkgs/development/web/deno/update/librusty_v8.ts
+++ b/pkgs/development/web/deno/update/librusty_v8.ts
@@ -1,11 +1,5 @@
-import * as toml from "https://deno.land/std@0.148.0/encoding/toml.ts";
-import {
-  getExistingVersion,
-  logger,
-  run,
-  write,
-} from "./common.ts";
-
+import * as toml from "https://deno.land/std@0.202.0/toml/mod.ts";
+import { getExistingVersion, logger, run, write } from "./common.ts";
 
 const log = logger("librusty_v8");
 
@@ -18,14 +12,14 @@ interface PrefetchResult {
   sha256: string;
 }
 
-const getLibrustyV8Version = async (
+const getCargoLock = async (
   owner: string,
   repo: string,
   version: string,
 ) =>
-  fetch(`https://github.com/${owner}/${repo}/raw/${version}/Cargo.toml`)
+  fetch(`https://github.com/${owner}/${repo}/raw/${version}/Cargo.lock`)
     .then((res) => res.text())
-    .then((txt) => toml.parse(txt).workspace.dependencies.v8.version);
+    .then((txt) => toml.parse(txt));
 
 const fetchArchShaTasks = (version: string, arches: Architecture[]) =>
   arches.map(
@@ -46,13 +40,12 @@ fetchurl {
 
 const templateDeps = (version: string, deps: PrefetchResult[]) =>
   `# auto-generated file -- DO NOT EDIT!
-{ rust, stdenv, fetchurl }:
+{ stdenv, fetchurl }:
 
 let
-  arch = rust.toRustTarget stdenv.hostPlatform;
   fetch_librusty_v8 = args: fetchurl {
     name = "librusty_v8-\${args.version}";
-    url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${arch}.a";
+    url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${stdenv.hostPlatform.rust.rustcTarget}.a";
     sha256 = args.shas.\${stdenv.hostPlatform.system};
     meta = { inherit (args) version; };
   };
@@ -74,7 +67,10 @@ export async function updateLibrustyV8(
 ) {
   log("Starting librusty_v8 update");
   // 0.0.0
-  const version = await getLibrustyV8Version(owner, repo, denoVersion);
+  const cargoLockData = await getCargoLock(owner, repo, denoVersion);
+  console.log(cargoLockData);
+  const packageItem = cargoLockData.package.find(({ name }) => name === "v8");
+  const version = packageItem.version;
   if (typeof version !== "string") {
     throw "no librusty_v8 version";
   }