mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 08:55:07 +03:00
build.ts only deps on deno
prevents dep injection
This commit is contained in:
parent
d617f2e3b1
commit
d9be5a35f9
5 changed files with 29 additions and 12 deletions
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
@ -153,6 +153,7 @@ jobs:
|
||||||
- run: tea.xyz/var/pantry/scripts/test.ts ${{ inputs.projects }}
|
- run: tea.xyz/var/pantry/scripts/test.ts ${{ inputs.projects }}
|
||||||
|
|
||||||
bottle:
|
bottle:
|
||||||
|
name: ${{ matrix.name }}
|
||||||
needs: [test, build]
|
needs: [test, build]
|
||||||
if: ${{ inputs.upload }}
|
if: ${{ inputs.upload }}
|
||||||
runs-on: ${{ matrix.platform.os }}
|
runs-on: ${{ matrix.platform.os }}
|
||||||
|
@ -163,11 +164,15 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- os: macos-11
|
- os: macos-11
|
||||||
|
name: darwin+x86-64
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
|
name: linux+x86-64
|
||||||
- os: [self-hosted, macOS, ARM64]
|
- os: [self-hosted, macOS, ARM64]
|
||||||
tag: darwin-aarch64
|
tag: darwin-aarch64
|
||||||
|
name: darwin+aarch64
|
||||||
- os: [self-hosted, linux, ARM64]
|
- os: [self-hosted, linux, ARM64]
|
||||||
tag: linux-aarch64
|
tag: linux-aarch64
|
||||||
|
name: linux+aarch64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/env -S tea -E
|
#!/usr/bin/env -S tea -E
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
dependencies:
|
|
||||||
gnu.org/tar: 1
|
|
||||||
tukaani.org/xz: 5
|
|
||||||
sourceware.org/bzip2: 1
|
|
||||||
args:
|
args:
|
||||||
- deno
|
- deno
|
||||||
- run
|
- run
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/env -S tea -E
|
#!/usr/bin/env -S tea -E
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
dependencies:
|
|
||||||
gnu.org/tar: 1
|
|
||||||
tukaani.org/xz: 5
|
|
||||||
sourceware.org/bzip2: 1
|
|
||||||
args:
|
args:
|
||||||
- deno
|
- deno
|
||||||
- run
|
- run
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { run, undent, host, tuplize } from "utils"
|
||||||
import { str as pkgstr } from "utils/pkg.ts"
|
import { str as pkgstr } from "utils/pkg.ts"
|
||||||
import fix_pkg_config_files from "./fix-pkg-config-files.ts"
|
import fix_pkg_config_files from "./fix-pkg-config-files.ts"
|
||||||
import Path from "path"
|
import Path from "path"
|
||||||
import { fetch_src } from "../fetch.ts";
|
|
||||||
|
|
||||||
const cellar = useCellar()
|
const cellar = useCellar()
|
||||||
const pantry = usePantry()
|
const pantry = usePantry()
|
||||||
|
@ -142,3 +141,18 @@ async function __build(pkg: Package): Promise<BuildResult> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)]
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#!/usr/bin/env -S tea -E
|
#!/usr/bin/env -S tea -E
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
|
dependencies:
|
||||||
|
gnu.org/tar: 1
|
||||||
|
tukaani.org/xz: 5
|
||||||
|
sourceware.org/bzip2: 1
|
||||||
args:
|
args:
|
||||||
- deno
|
- deno
|
||||||
- run
|
- run
|
||||||
|
@ -14,12 +18,14 @@ args:
|
||||||
|
|
||||||
//TODO verify the sha
|
//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 { panic, print } from "utils"
|
||||||
import { Stowage, Package } from "types"
|
import { Stowage, Package } from "types"
|
||||||
import * as ARGV from "./utils/args.ts"
|
import * as ARGV from "./utils/args.ts"
|
||||||
import Path from "path"
|
import Path from "path"
|
||||||
|
|
||||||
|
useFlags()
|
||||||
|
|
||||||
const pantry = usePantry()
|
const pantry = usePantry()
|
||||||
const { download } = useDownload()
|
const { download } = useDownload()
|
||||||
|
|
||||||
|
@ -47,7 +53,7 @@ export async function fetch_src(pkg: Package): Promise<[Path, Path] | undefined>
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
for await (let pkg of ARGV.pkgs()) {
|
for await (let pkg of ARGV.pkgs()) {
|
||||||
pkg = await pantry.resolve(pkg)
|
pkg = await pantry.resolve(pkg)
|
||||||
const [dstdir] = await fetch_src(pkg) ?? panic()
|
const rv = await fetch_src(pkg) ?? panic()
|
||||||
await print(`${dstdir}\n`)
|
await print(rv.join("\n") + "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue