mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
Don’t use sort.ts
in CI to pre-install
The `dry` packages end up being constraints for the whole graph which in cyclic situations prevents bootstrapping. Eg. llvm^12 cannot be built because sort insists that it depends on llvm^12 which is not yet bottled.
This commit is contained in:
parent
2bb2229be6
commit
8a59338e83
3 changed files with 32 additions and 30 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -73,10 +73,8 @@ jobs:
|
|||
- run: /opt/tea.xyz/var/pantry/scripts/sort.ts ${{ inputs.projects }}
|
||||
id: sorted
|
||||
|
||||
- run: cli/scripts/install.ts ${{ steps.sorted.outputs.pre-install }}
|
||||
|
||||
# running out of /opt because only pantry.core has these scripts
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/build.plumbing.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
- run: /opt/tea.xyz/var/pantry/scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
id: build
|
||||
env:
|
||||
# GITHUB_TOKEN doesn't have private access to teaxyz/cli.
|
||||
|
|
|
@ -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
|
||||
|
@ -13,25 +17,28 @@ args:
|
|||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { usePantry, useFlags, useCellar, useInventory } from "hooks"
|
||||
import { usePantry, useFlags, useCellar, useInventory, usePrefix } from "hooks"
|
||||
import { hydrate, install, link } from "prefab"
|
||||
import { str as pkgstr } from "utils/pkg.ts"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { panic } from "utils/error.ts"
|
||||
import build from "./build/build.ts"
|
||||
import build, { BuildResult } from "./build/build.ts"
|
||||
import { set_output } from "./utils/gha.ts";
|
||||
|
||||
useFlags()
|
||||
|
||||
const pantry = usePantry()
|
||||
const cellar = useCellar()
|
||||
const inventory = useInventory()
|
||||
const dry = await ARGV.toArray(ARGV.pkgs())
|
||||
const wet = await hydrate(dry, async (pkg, dry) => {
|
||||
const deps = await pantry.getDeps(pkg)
|
||||
return dry ? [...deps.build, ...deps.runtime] : deps.runtime
|
||||
})
|
||||
const raw = await ARGV.toArray(ARGV.pkgs())
|
||||
|
||||
for (const pkg of wet.wet) {
|
||||
const rv: BuildResult[] = []
|
||||
|
||||
for (const rq of raw) {
|
||||
const dry = await pantry.getDeps(rq)
|
||||
const wet = await hydrate([...dry.runtime, ...dry.build])
|
||||
|
||||
for (const pkg of wet.pkgs) {
|
||||
if (!await cellar.has(pkg)) {
|
||||
const version = await inventory.select(pkg) ?? panic(`${pkgstr(pkg)} not found`)
|
||||
const installation = await install({ project: pkg.project, version })
|
||||
|
@ -39,8 +46,14 @@ for (const pkg of wet.wet) {
|
|||
}
|
||||
}
|
||||
|
||||
for (const rq of dry) {
|
||||
const pkg = await pantry.resolve(rq)
|
||||
await build(pkg)
|
||||
rv.push(await build(pkg))
|
||||
await link(pkg)
|
||||
}
|
||||
|
||||
const to = usePrefix()
|
||||
await set_output("pkgs", rv.map(x => pkgstr(x.installation.pkg)))
|
||||
await set_output("paths", rv.map(x => x.installation.path), '%0A')
|
||||
await set_output("relative-paths", rv.map(x => x.installation.path.relative({ to })))
|
||||
await set_output("srcs", rv.map(x => x.src?.relative({ to }) ?? "~"))
|
||||
await set_output("srcs-relative-paths", rv.compact(x => x.src?.relative({ to })))
|
||||
|
|
|
@ -16,8 +16,8 @@ args:
|
|||
import { pkg } from "utils"
|
||||
import { usePantry, useFlags } from "hooks"
|
||||
import { hydrate } from "prefab"
|
||||
import { PackageRequirement } from "types"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { set_output } from "./utils/gha.ts";
|
||||
|
||||
const flags = useFlags()
|
||||
const pantry = usePantry()
|
||||
|
@ -30,18 +30,9 @@ const wet = await hydrate(dry, async (pkg, dry) => {
|
|||
})
|
||||
|
||||
if (Deno.env.get("GITHUB_ACTIONS")) {
|
||||
const massage = (input: PackageRequirement[]) =>
|
||||
input.map(p => {
|
||||
let out = pkg.str(p)
|
||||
// shell quoting via GHA is weird and we don’t fully understand it
|
||||
if (/[<>]/.test(out)) out = `"${out}"`
|
||||
return out
|
||||
}).join(" ")
|
||||
|
||||
console.log(`::set-output name=pkgs::${massage(wet.dry)}`)
|
||||
console.log(`::set-output name=pre-install::${massage(wet.wet)}`)
|
||||
await set_output('pkgs', wet.dry.map(pkg.str))
|
||||
} else {
|
||||
const gas = wet.dry.map(x => pkg.str(x))
|
||||
const gas = wet.dry.map(pkg.str)
|
||||
if (flags.json) {
|
||||
console.log(gas)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue