Upload .tar.xz bottles too

This commit is contained in:
Max Howell 2022-09-26 10:56:15 -04:00
parent ede28cb81e
commit 5fb72446cf
2 changed files with 12 additions and 5 deletions

View file

@ -1,6 +1,10 @@
#!/usr/bin/env -S tea -E #!/usr/bin/env -S tea -E
/* --- /* ---
dependencies:
gnu.org/tar: ^1.34
tukaani.org/xz: ^5
zlib.net: 1
args: args:
- deno - deno
- run - run
@ -27,6 +31,8 @@ const cellar = useCellar()
if (import.meta.main) { if (import.meta.main) {
useFlags() useFlags()
const compression = Deno.env.get("COMPRESSION") == 'xz' ? 'xz' : 'gz'
const bottles: Path[] = [] const bottles: Path[] = []
const checksums: Path[] = [] const checksums: Path[] = []
const artifacts: Path[] = [] const artifacts: Path[] = []
@ -34,7 +40,7 @@ if (import.meta.main) {
console.log({ bottling: { pkg } }) console.log({ bottling: { pkg } })
const installation = await cellar.resolve(pkg) const installation = await cellar.resolve(pkg)
const path = await bottle(installation) const path = await bottle(installation, compression)
const checksum = await sha256(path) const checksum = await sha256(path)
console.log({ bottled: { path } }) console.log({ bottled: { path } })
@ -60,10 +66,11 @@ if (import.meta.main) {
//------------------------------------------------------------------------- funcs //------------------------------------------------------------------------- funcs
export async function bottle({ path: kegdir, pkg }: Installation): Promise<Path> { export async function bottle({ path: kegdir, pkg }: Installation, compression: 'gz' | 'xz'): Promise<Path> {
const tarball = useCache().bottle(pkg) const tarball = useCache().bottle(pkg, compression)
const z = compression == 'gz' ? 'z' : 'J'
const cwd = usePrefix() const cwd = usePrefix()
const cmd = ["tar", "zcf", tarball, kegdir.relative({ to: cwd })] const cmd = ["tar", `c${z}f`, tarball, kegdir.relative({ to: cwd })]
await run({ cmd, cwd }) await run({ cmd, cwd })
return tarball return tarball
} }

View file

@ -12,7 +12,7 @@ args:
- --import-map={{ srcroot }}/import-map.json - --import-map={{ srcroot }}/import-map.json
---*/ ---*/
import { Installation, Package, PackageRequirement } from "types" import { Package, PackageRequirement } from "types"
import { usePantry, useCellar, useFlags } from "hooks" import { usePantry, useCellar, useFlags } from "hooks"
import useShellEnv, { expand } from "hooks/useShellEnv.ts" import useShellEnv, { expand } from "hooks/useShellEnv.ts"
import { run, undent, pkg as pkgutils } from "utils" import { run, undent, pkg as pkgutils } from "utils"