From d9be5a35f9e403b1d0a7b40547cbabd6c8edbc84 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 30 Nov 2022 15:18:05 -0500 Subject: [PATCH] build.ts only deps on deno prevents dep injection --- .github/workflows/build.yml | 5 +++++ scripts/build.plumbing.ts | 4 ---- scripts/build.ts | 4 ---- scripts/build/build.ts | 16 +++++++++++++++- scripts/fetch.ts | 12 +++++++++--- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d95b190e..d4c16b7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,6 +153,7 @@ jobs: - run: tea.xyz/var/pantry/scripts/test.ts ${{ inputs.projects }} bottle: + name: ${{ matrix.name }} needs: [test, build] if: ${{ inputs.upload }} runs-on: ${{ matrix.platform.os }} @@ -163,11 +164,15 @@ jobs: matrix: platform: - os: macos-11 + name: darwin+x86-64 - os: ubuntu-latest + name: linux+x86-64 - os: [self-hosted, macOS, ARM64] tag: darwin-aarch64 + name: darwin+aarch64 - os: [self-hosted, linux, ARM64] tag: linux-aarch64 + name: linux+aarch64 steps: - uses: actions/checkout@v3 with: diff --git a/scripts/build.plumbing.ts b/scripts/build.plumbing.ts index bc8310fe..85f7bbd5 100755 --- a/scripts/build.plumbing.ts +++ b/scripts/build.plumbing.ts @@ -1,10 +1,6 @@ #!/usr/bin/env -S tea -E /*--- -dependencies: - gnu.org/tar: 1 - tukaani.org/xz: 5 - sourceware.org/bzip2: 1 args: - deno - run diff --git a/scripts/build.ts b/scripts/build.ts index 2055deb9..36bd31c3 100755 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,10 +1,6 @@ #!/usr/bin/env -S tea -E /*--- -dependencies: - gnu.org/tar: 1 - tukaani.org/xz: 5 - sourceware.org/bzip2: 1 args: - deno - run diff --git a/scripts/build/build.ts b/scripts/build/build.ts index 5f2da99e..46f0c8fd 100644 --- a/scripts/build/build.ts +++ b/scripts/build/build.ts @@ -6,7 +6,6 @@ import { run, undent, host, tuplize } from "utils" import { str as pkgstr } from "utils/pkg.ts" import fix_pkg_config_files from "./fix-pkg-config-files.ts" import Path from "path" -import { fetch_src } from "../fetch.ts"; const cellar = useCellar() const pantry = usePantry() @@ -142,3 +141,18 @@ async function __build(pkg: Package): Promise { } } } + +async function fetch_src(pkg: Package): Promise<[Path, Path]> { + console.log('fetching', pkgstr(pkg)) + + // we run this as a script because we don’t want these deps imported into *this* env + // since that leads to situations where we depend on things we didn’t expect to + const script = new URL(import.meta.url).path().parent().parent().join('fetch.ts') + const proc = Deno.run({ + cmd: [script.string, pkgstr(pkg)], + stdout: 'piped' + }) + const out = await proc.output() + const [dstdir, tarball] = new TextDecoder().decode(out).split("\n") + return [new Path(dstdir), new Path(tarball)] +} diff --git a/scripts/fetch.ts b/scripts/fetch.ts index 501e258b..45bbc1a7 100755 --- a/scripts/fetch.ts +++ b/scripts/fetch.ts @@ -1,6 +1,10 @@ #!/usr/bin/env -S tea -E /*--- +dependencies: + gnu.org/tar: 1 + tukaani.org/xz: 5 + sourceware.org/bzip2: 1 args: - deno - run @@ -14,12 +18,14 @@ args: //TODO verify the sha -import { usePantry, useCache, useDownload, useCellar, useSourceUnarchiver, useOffLicense } from "hooks" +import { usePantry, useCache, useDownload, useCellar, useSourceUnarchiver, useOffLicense, useFlags} from "hooks" import { panic, print } from "utils" import { Stowage, Package } from "types" import * as ARGV from "./utils/args.ts" import Path from "path" +useFlags() + const pantry = usePantry() const { download } = useDownload() @@ -47,7 +53,7 @@ export async function fetch_src(pkg: Package): Promise<[Path, Path] | undefined> if (import.meta.main) { for await (let pkg of ARGV.pkgs()) { pkg = await pantry.resolve(pkg) - const [dstdir] = await fetch_src(pkg) ?? panic() - await print(`${dstdir}\n`) + const rv = await fetch_src(pkg) ?? panic() + await print(rv.join("\n") + "\n") } }