Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/ci.actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ on:
pull_request:
workflow_call:

env:
# FIXME
# we must set this or pkgx won’t find the main pantry after $HOME is changed
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
# FIXME add PKGX_HOME to libpkgx
XDG_DATA_HOME: ${{github.workspace}}/.data

jobs:
build:
runs-on: ${{ matrix.platform.os }}
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/ci.cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ on:
env:
GITHUB_TOKEN: ${{github.token}}
PKGX_PANTRY_PATH: ${{github.workspace}}
# FIXME
# we must set this or pkgx won’t find the main pantry after $HOME is changed
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
# FIXME add PKGX_HOME to libpkgx
XDG_DATA_HOME: ${{github.workspace}}/.data

jobs:
integration-tests:
Expand Down
11 changes: 9 additions & 2 deletions bin/cmd/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ console.log("install:", config.path.install)
console.log("build-install:", config.path.build_install)

if (options.clean) {
gum("# cleaning")
gum("cleaning")
config.path.home.rm({recursive: true})
config.path.install.rm({recursive: true})
config.path.build_install.rm({recursive: true})
Expand Down Expand Up @@ -100,7 +100,14 @@ const env: Record<string, string> = {
PATH: '/usr/bin:/bin:/usr/sbin:/sbin',
PKGX_DIR: useConfig().prefix.string
}
for (const key of ['HOME', 'PKGX_PANTRY_PATH', 'XDG_DATA_HOME', 'GITHUB_TOKEN', 'LANG', 'LOGNAME', 'USER']) {

// compute sanitized `env` the script will run within
for (const key of [
'HOME',
'PKGX_PANTRY_PATH', // otherwise we cannot build against the user’s pantry
'GITHUB_TOKEN', // pass through for `gh` and that sort of thing
'LANG', 'LOGNAME', 'USER' // prevent POSIX tools from breaking
]) {
const value = Deno.env.get(key)
if (value) env[key] = value
}
Expand Down
19 changes: 11 additions & 8 deletions bin/cmd/test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { gum, find_pkgx, rsync, find_in_PATH } from "brewkit/utils.ts"
import get_config from "brewkit/config.ts"
import * as YAML from "deno/yaml/mod.ts"
import undent from "outdent"
const { useConfig, usePantry } = hooks
import useConfig from "libpkgx/hooks/useConfig.ts";
const { usePantry } = hooks

await gum('computing configuration')
const config = await get_config(Deno.args[0])
Expand Down Expand Up @@ -40,12 +41,11 @@ const script_text = undent`

set -eo pipefail

export PKGX_DIR="${useConfig().prefix}"

${gum_} format "## env"
set -a
eval "$(CLICOLOR_FORCE=1 ${pkgx} ${env_plus})" || exit $?
set +a
export PKGX_HOME="$HOME"
set -a
eval "$(CLICOLOR_FORCE=1 ${pkgx} ${env_plus})" || exit $?
set +a

command_not_found_handle() {
echo "::warning::\\\`$1\\\` is not an explicit dependency!"
Expand Down Expand Up @@ -86,8 +86,11 @@ script.write({ force: true, text: script_text }).chmod(0o755)

await gum("test")

const env: Record<string, string> = {PATH: '/usr/bin:/bin:/usr/sbin:/sbin'}
for (const key of ['HOME', 'PKGX_PANTRY_PATH', 'XDG_DATA_HOME', 'GITHUB_TOKEN', 'LANG', 'LOGNAME', 'USER']) {
const env: Record<string, string> = {
PATH: '/usr/bin:/bin:/usr/sbin:/sbin',
PKGX_DIR: useConfig().prefix.string
}
for (const key of ['HOME', 'PKGX_PANTRY_PATH', 'GITHUB_TOKEN', 'LANG', 'LOGNAME', 'USER']) {
const value = Deno.env.get(key)
if (value) env[key] = value
}
Expand Down
3 changes: 2 additions & 1 deletion lib/hooks/usePantry.getScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SupportedPlatforms, SupportedArchitectures } from "libpkgx/utils/host.t
import { isArray, isString, isPlainObject, PlainObject, isPrimitive, isBoolean, isNumber } from "is-what"
import { Package, Installation, hooks, utils, semver, Path, PantryParseError } from "libpkgx"
import undent from "outdent"
import { panic } from "libpkgx/utils/error.ts";

const { validate, host } = utils
const { useMoustaches } = hooks
Expand Down Expand Up @@ -149,7 +150,7 @@ function add_fixture(run: string, key: string, obj: any, tokens: { from: string,
let extname = `${fixture['extname'] || ''}`
while (extname.startsWith('.')) extname = extname.slice(1)

const contents = isPlainObject(fixture) ? fixture['content'] : fixture
const contents = isPlainObject(fixture) ? (fixture['content'] ?? fixture['contents'] ?? panic()) : fixture

fixture_key = fixture_key.toUpperCase()

Expand Down
2 changes: 1 addition & 1 deletion lib/porcelain/build-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export default async function(config: Config, PATH?: Path): Promise<string> {
set -eo pipefail

${gum} format "## env"
export PKGX_HOME="$HOME"
export PATH="${brewkit_PATHs}:$PATH"
set -a
${env_plus ? `eval "$(CLICOLOR_FORCE=1 ${pkgx} ${env_plus})"` : ''}
set +a

export PKGX="${pkgx}"
export SRCROOT=${config.path.build.string}
#TODO export XDG_CACHE_HOME="${config.path.cache.string}"
export HOME=${config.path.home.string}
if [ -n "$CI" ]; then
export FORCE_UNSAFE_CONFIGURE=1
Expand Down