Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 43 lines 1.6 kB view raw
1#!/usr/bin/env nix-shell 2/* 3#!nix-shell -i "deno run --allow-net --allow-run --allow-read --allow-write" -p deno git nix-prefetch 4*/ 5import { getExistingVersion, getLatestVersion, logger } from "./common.ts"; 6import { Architecture, updateLibrustyV8 } from "./librusty_v8.ts"; 7import { updateSrc } from "./src.ts"; 8 9const log = logger("update"); 10// TODO: Getting current file position to more-safely point to nixpkgs root 11const nixpkgs = Deno.cwd(); 12// TODO: Read values from default.nix 13const owner = "denoland"; 14const repo = "deno"; 15const denoDir = `${nixpkgs}/pkgs/development/web/${repo}`; 16const src = `${denoDir}/default.nix`; 17const librusty_v8 = `${denoDir}/librusty_v8.nix`; 18const architectures: Architecture[] = [ 19 { nix: "x86_64-linux", rust: "x86_64-unknown-linux-gnu" }, 20 { nix: "aarch64-linux", rust: "aarch64-unknown-linux-gnu" }, 21 { nix: "x86_64-darwin", rust: "x86_64-apple-darwin" }, 22 { nix: "aarch64-darwin", rust: "aarch64-apple-darwin" }, 23]; 24 25log("Updating deno"); 26 27log("Getting latest deno version"); 28const version = await getLatestVersion(owner, repo); 29const existingVersion = await getExistingVersion(src); 30const trimVersion = version.substr(1); // Strip v from v0.0.0 31log("Latest version: ", trimVersion); 32log("Extracted version:", existingVersion); 33if (trimVersion === existingVersion) { 34 log("Version already matches latest, skipping..."); 35 Deno.exit(0); 36} 37 38const tasks = [ 39 updateSrc(src, nixpkgs, version), 40 updateLibrustyV8(librusty_v8, owner, repo, version, architectures), 41]; 42await Promise.all(tasks); 43log("Updating deno complete");