deno: cleanups, potential infrequent build failure fix (#516229)

This commit is contained in:
j-k
2026-05-05 09:36:55 +00:00
committed by GitHub
7 changed files with 11 additions and 98 deletions
-21
View File
@@ -1,21 +0,0 @@
# not a stable interface, do not reference outside the deno package but make a
# copy if you need
{
lib,
stdenv,
fetchurl,
}:
{
fetchLibrustyV8 =
args:
fetchurl {
name = "librusty_v8-${args.version}";
url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_simdutf_release_${stdenv.hostPlatform.rust.rustcTarget}.a.gz";
sha256 = args.shas.${stdenv.hostPlatform.system};
meta = {
inherit (args) version;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
};
}
+2 -2
View File
@@ -9,7 +9,7 @@
protobuf,
installShellFiles,
makeBinaryWrapper,
librusty_v8 ? callPackage ./librusty_v8.nix { },
librusty_v8 ? callPackage ./rusty-v8 { },
libffi,
sqlite,
lld,
@@ -248,7 +248,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
};
meta = {
homepage = "https://deno.land/";
homepage = "https://deno.com/";
changelog = "https://github.com/denoland/deno/releases/tag/v${finalAttrs.version}";
description = "Secure runtime for JavaScript and TypeScript";
longDescription = ''
@@ -132,7 +132,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"rustc_version=\"${rustc.version}\""
"rust_sysroot_absolute=\"${rustToolchain}\""
"rust_bindgen_root=\"${rustToolchain}\""
"use_chromium_rust_toolchain=true"
# To accomodate our newer rustc compiler
"removed_rust_stdlib_libs=[\"adler\"]"
"added_rust_stdlib_libs=[\"adler2\"]"
@@ -145,6 +144,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
buildFeatures = [ "simdutf" ];
hardeningDisable = [
# rusty-v8 has its own default hardening flags, which are "extensive" for release builds as long as `use_custom_libcxx` stays true.
# Avoids many warnings about redefined macros (on build failures) and uses the upstream flag.
"libcxxhardeningfast"
# from Arch Linux: this uses malloc_usable_size, which is incompatible with fortification level 3
# https://gitlab.archlinux.org/archlinux/packaging/packages/deno/-/blob/cd9bdf9e67381da413142413646bd8648807510a/PKGBUILD#L49
"fortify3"
];
checkFlags = [
# These tests probably fail due to a more recent rustc version (upstream: 1.89.0, here: 1.93.0)
"--skip=ui"
@@ -1,74 +0,0 @@
import * as toml from "jsr:@std/toml@1.0.1";
import { getExistingVersion, logger, run, write } from "./common.ts";
const log = logger("librusty_v8");
export interface Architecture {
nix: string;
rust: string;
}
interface PrefetchResult {
arch: Architecture;
sha256: string;
}
const getCargoLock = async (
owner: string,
repo: string,
version: string,
) =>
fetch(`https://github.com/${owner}/${repo}/raw/${version}/Cargo.lock`)
.then((res) => res.text())
.then((txt) => toml.parse(txt));
const fetchArchShaTasks = (version: string, arches: Architecture[]) =>
arches.map(
async (arch: Architecture): Promise<PrefetchResult> => {
log("Fetching:", arch.nix);
const sha256 = await run("nix-prefetch-url", [
`https://github.com/denoland/rusty_v8/releases/download/v${version}/librusty_v8_simdutf_release_${arch.rust}.a.gz`
]);
const sha256_sri = await run("nix-hash", ["--type", "sha256", "--to-sri", sha256]);
log("Done: ", arch.nix);
return { arch, sha256: sha256_sri };
},
);
const templateDeps = (version: string, deps: PrefetchResult[]) =>
`# auto-generated file -- DO NOT EDIT!
{ fetchLibrustyV8 }:
fetchLibrustyV8 {
version = "${version}";
shas = {
${deps.map(({ arch, sha256 }) => ` ${arch.nix} = "${sha256}";`).join("\n")}
};
}
`;
export async function updateLibrustyV8(
filePath: string,
owner: string,
repo: string,
denoVersion: string,
arches: Architecture[],
) {
log("Starting librusty_v8 update");
// 0.0.0
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";
}
log("librusty_v8 version:", version);
const existingVersion = await getExistingVersion(filePath);
if (version === existingVersion) {
log("Version already matches latest, skipping...");
return;
}
const archShaResults = await Promise.all(fetchArchShaTasks(version, arches));
await write(filePath, templateDeps(version, archShaResults));
log("Finished deps update");
}