mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
test +librsvg (#115)
This commit is contained in:
parent
bbc22ab67f
commit
dc90621902
|
@ -21,19 +21,20 @@ build:
|
||||||
gnome.org/gobject-introspection: 1
|
gnome.org/gobject-introspection: 1
|
||||||
python.org: 3
|
python.org: 3
|
||||||
script: |
|
script: |
|
||||||
if test {{ hw.platform }} = linux; then
|
|
||||||
#FIXME so linux configure finds shared-mime-info
|
|
||||||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/share/pkgconfig"
|
|
||||||
#FIXME so linux build finds the shared-mime-info cache
|
|
||||||
export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
|
|
||||||
fi
|
|
||||||
|
|
||||||
./configure \
|
./configure \
|
||||||
--prefix={{ prefix }} \
|
--prefix={{ prefix }} \
|
||||||
--enable-pixbuf-loader=yes \
|
--enable-pixbuf-loader=yes \
|
||||||
--enable-introspection=yes \
|
--enable-introspection=yes \
|
||||||
--disable-Bsymbolic
|
--disable-Bsymbolic
|
||||||
make V=1
|
make --jobs {{hw.concurrency}} install
|
||||||
make install
|
|
||||||
|
|
||||||
test: true #FIXME
|
test:
|
||||||
|
dependencies:
|
||||||
|
freedesktop.org/pkg-config: ^0.29
|
||||||
|
tea.xyz/gx/cc: c99
|
||||||
|
script: |
|
||||||
|
cc test.c $CFLAGS $LDFLAGS
|
||||||
|
./a.out
|
||||||
|
env:
|
||||||
|
CFLAGS: $(pkg-config --cflags librsvg-2.0) #FIXME should be in env automatically
|
||||||
|
LDFLAGS: $(pkg-config --libs librsvg-2.0)
|
||||||
|
|
6
projects/gnome.org/librsvg/test.c
Normal file
6
projects/gnome.org/librsvg/test.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <librsvg/rsvg.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
RsvgHandle *handle = rsvg_handle_new();
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -21,16 +21,14 @@ import build from "prefab/build.ts"
|
||||||
import { Package, parsePackageRequirement, semver } from "types"
|
import { Package, parsePackageRequirement, semver } from "types"
|
||||||
import useFlags from "hooks/useFlags.ts"
|
import useFlags from "hooks/useFlags.ts"
|
||||||
import usePlatform from "hooks/usePlatform.ts"
|
import usePlatform from "hooks/usePlatform.ts"
|
||||||
|
import hydrate from "prefab/hydrate.ts"
|
||||||
|
|
||||||
useFlags()
|
useFlags()
|
||||||
|
|
||||||
const pantry = usePantry()
|
const pantry = usePantry()
|
||||||
const cellar = useCellar()
|
const cellar = useCellar()
|
||||||
|
|
||||||
const dry = Deno.args.map(project => {
|
const dry = Deno.args.map(parsePackageRequirement)
|
||||||
const match = project.match(/projects\/(.*)\/package.yml/)
|
|
||||||
return match ? match[1] : project
|
|
||||||
}).map(parsePackageRequirement)
|
|
||||||
|
|
||||||
const rv: Package[] = []
|
const rv: Package[] = []
|
||||||
for (const pkgrq of dry) {
|
for (const pkgrq of dry) {
|
||||||
|
@ -39,11 +37,6 @@ for (const pkgrq of dry) {
|
||||||
if (!version) throw "no-version-found"
|
if (!version) throw "no-version-found"
|
||||||
const pkg = { project: pkgrq.project, version }
|
const pkg = { project: pkgrq.project, version }
|
||||||
|
|
||||||
if (Deno.env.get("SKIP") && await cellar.isInstalled(pkg)) {
|
|
||||||
console.log({ skipping: pkg.project })
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log({ building: pkgrq.project })
|
console.log({ building: pkgrq.project })
|
||||||
|
|
||||||
// Get the source
|
// Get the source
|
||||||
|
@ -59,7 +52,10 @@ for (const pkgrq of dry) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO this was already calculated in `sort` and should not be recalculated
|
||||||
const deps = await pantry.getDeps(pkg)
|
const deps = await pantry.getDeps(pkg)
|
||||||
|
const wet = await hydrate(deps.runtime, pkg => pantry.getDeps(pkg).then(x => x.runtime))
|
||||||
|
deps.runtime.push(...wet.pkgs)
|
||||||
|
|
||||||
const env = usePlatform().platform == 'darwin'
|
const env = usePlatform().platform == 'darwin'
|
||||||
? {MACOSX_DEPLOYMENT_TARGET: ['11.0']}
|
? {MACOSX_DEPLOYMENT_TARGET: ['11.0']}
|
||||||
|
|
38
scripts/filter.ts
Executable file
38
scripts/filter.ts
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/env -S tea -E
|
||||||
|
|
||||||
|
/*---
|
||||||
|
args:
|
||||||
|
- deno
|
||||||
|
- run
|
||||||
|
- --allow-net
|
||||||
|
- --allow-run
|
||||||
|
- --allow-read
|
||||||
|
- --allow-write
|
||||||
|
- --allow-env
|
||||||
|
- --import-map={{ srcroot }}/import-map.json
|
||||||
|
---*/
|
||||||
|
|
||||||
|
import { parsePackageRequirement } from "types"
|
||||||
|
import useCellar from "hooks/useCellar.ts"
|
||||||
|
import useFlags from "hooks/useFlags.ts"
|
||||||
|
|
||||||
|
useFlags()
|
||||||
|
|
||||||
|
/// filters out everything that is already installed
|
||||||
|
|
||||||
|
const cellar = useCellar()
|
||||||
|
const desired_filter = !!Deno.env.get("INVERT")
|
||||||
|
|
||||||
|
const rv: string[] = []
|
||||||
|
for (const pkg of Deno.args.map(parsePackageRequirement)) {
|
||||||
|
const isInstalled = !!await cellar.isInstalled(pkg)
|
||||||
|
if (isInstalled == desired_filter) {
|
||||||
|
rv.push(pkg.project)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Deno.env.get("GITHUB_ACTIONS")) {
|
||||||
|
console.log(`::set-output name=pkgs::${rv.join(" ")}\n`)
|
||||||
|
} else {
|
||||||
|
console.log(rv.join("\n"))
|
||||||
|
}
|
|
@ -12,11 +12,10 @@ args:
|
||||||
- --import-map={{ srcroot }}/import-map.json
|
- --import-map={{ srcroot }}/import-map.json
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
import { parsePackage, semver, Path, PackageRequirement, PlainObject, parsePackageRequirement } from "types"
|
import { parsePackage, semver, Path, PackageRequirement, parsePackageRequirement } from "types"
|
||||||
import usePantry from "hooks/usePantry.ts"
|
import usePantry from "hooks/usePantry.ts"
|
||||||
import useShellEnv, { expand } from "hooks/useShellEnv.ts"
|
import useShellEnv, { expand } from "hooks/useShellEnv.ts"
|
||||||
import { run, undent, isPlainObject } from "utils"
|
import { run, undent } from "utils"
|
||||||
import { validatePackageRequirement } from "utils/lvl2.ts"
|
|
||||||
import useFlags from "hooks/useFlags.ts"
|
import useFlags from "hooks/useFlags.ts"
|
||||||
import useCellar from "hooks/useCellar.ts"
|
import useCellar from "hooks/useCellar.ts"
|
||||||
import resolve from "prefab/resolve.ts"
|
import resolve from "prefab/resolve.ts"
|
||||||
|
@ -24,14 +23,12 @@ import install from "prefab/install.ts"
|
||||||
import hydrate from "prefab/hydrate.ts"
|
import hydrate from "prefab/hydrate.ts"
|
||||||
import { lvl1 as link } from "prefab/link.ts"
|
import { lvl1 as link } from "prefab/link.ts"
|
||||||
|
|
||||||
const { debug } = useFlags()
|
const { debug, magic } = useFlags()
|
||||||
const cellar = useCellar()
|
const cellar = useCellar()
|
||||||
|
|
||||||
//TODO install any other deps
|
|
||||||
|
|
||||||
const pantry = usePantry()
|
const pantry = usePantry()
|
||||||
|
|
||||||
const pkg = await (async () => {
|
const pkg = await (async () => {
|
||||||
if (Deno.args[1] == "--magic") {
|
if (magic) {
|
||||||
const i = await cellar.resolve(parsePackageRequirement(Deno.args[0]))
|
const i = await cellar.resolve(parsePackageRequirement(Deno.args[0]))
|
||||||
return i.pkg
|
return i.pkg
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,11 +41,14 @@ const self = {
|
||||||
constraint: new semver.Range(pkg.version.toString())
|
constraint: new semver.Range(pkg.version.toString())
|
||||||
}
|
}
|
||||||
const [yml] = await pantry.getYAML(pkg)
|
const [yml] = await pantry.getYAML(pkg)
|
||||||
const deps: PackageRequirement[] = [self, ...await get_deps()]
|
const deps = (await hydrate(self, async (pkg, dry) => {
|
||||||
|
const { runtime, test } = await pantry.getDeps(pkg)
|
||||||
|
return dry ? [...runtime, ...test] : runtime
|
||||||
|
})).pkgs
|
||||||
|
|
||||||
await install_if_needed(deps)
|
await install_if_needed(deps)
|
||||||
|
|
||||||
const env = await useShellEnv(deps)
|
const env = await useShellEnv([self, ...deps])
|
||||||
|
|
||||||
let text = undent`
|
let text = undent`
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
@ -69,7 +69,6 @@ try {
|
||||||
text += `export FIXTURE="${fixture}"\n\n`
|
text += `export FIXTURE="${fixture}"\n\n`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const cwd = tmp.join("wd").mkdir()
|
const cwd = tmp.join("wd").mkdir()
|
||||||
|
|
||||||
text += `cd "${cwd}"\n\n`
|
text += `cd "${cwd}"\n\n`
|
||||||
|
@ -90,22 +89,7 @@ try {
|
||||||
if (!debug) tmp.rm({ recursive: true })
|
if (!debug) tmp.rm({ recursive: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get_deps() {
|
//TODO install step should do this for test requirements also
|
||||||
const rv: PackageRequirement[] = []
|
|
||||||
attempt(yml.dependencies)
|
|
||||||
attempt(yml.test.dependencies)
|
|
||||||
const { pkgs } = await hydrate(rv, pkg => pantry.getDeps(pkg).then(x=>x.runtime))
|
|
||||||
return pkgs
|
|
||||||
|
|
||||||
function attempt(obj: PlainObject) {
|
|
||||||
if (isPlainObject(obj))
|
|
||||||
for (const [project, constraint] of Object.entries(obj)) {
|
|
||||||
const pkg = validatePackageRequirement({ project, constraint })
|
|
||||||
if (pkg) rv.push(pkg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function install_if_needed(deps: PackageRequirement[]) {
|
async function install_if_needed(deps: PackageRequirement[]) {
|
||||||
const needed: PackageRequirement[] = []
|
const needed: PackageRequirement[] = []
|
||||||
for await (const rq of deps) {
|
for await (const rq of deps) {
|
||||||
|
|
Loading…
Reference in a new issue