From d484493ee0a6788d24ce9717a585fffc922e24a4 Mon Sep 17 00:00:00 2001 From: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com> Date: Mon, 23 Dec 2024 17:36:09 +0100 Subject: [PATCH] wip: wip --- .ghjk/lock.json | 90 +++++++++++++++++++++++++++++++++++----- ghjk.ts | 2 +- src/ghjk/cli.rs | 2 +- src/ghjk/config.rs | 11 +++-- src/ghjk/log.rs | 16 +++---- src/ghjk/systems/deno.rs | 15 ++++--- tests/envs.ts | 1 + tests/utils.ts | 13 ++++-- 8 files changed, 118 insertions(+), 32 deletions(-) diff --git a/.ghjk/lock.json b/.ghjk/lock.json index ad0600a..aa6148d 100644 --- a/.ghjk/lock.json +++ b/.ghjk/lock.json @@ -14,7 +14,7 @@ "version": "4.0.1", "buildDepConfigs": { "cpy_bs_ghrel": { - "version": "3.12.7", + "version": "3.13.1", "buildDepConfigs": { "tar_aa": { "version": "1.35", @@ -38,7 +38,7 @@ "specifiedVersion": false }, "bciqh4dfyevkzzvmnhuz7lcfqttkg5neg4ewhoxzofyuicavgk6pb7ia": { - "version": "3.12.7", + "version": "3.13.1", "buildDepConfigs": { "tar_aa": { "version": "1.35", @@ -72,7 +72,7 @@ "version": "3.9.0.0", "buildDepConfigs": { "cpy_bs_ghrel": { - "version": "3.12.7", + "version": "3.13.1", "buildDepConfigs": { "tar_aa": { "version": "1.35", @@ -117,7 +117,7 @@ "version": "3.31.0.1", "buildDepConfigs": { "cpy_bs_ghrel": { - "version": "3.12.7", + "version": "3.13.1", "buildDepConfigs": { "tar_aa": { "version": "1.35", @@ -247,6 +247,74 @@ "rust-src" ], "specifiedVersion": true + }, + "bciqeosxosr6ur7pu7gny33gy7dqubmxbcs4775xazb4zvaxavkd5rha": { + "version": "0.1.13", + "buildDepConfigs": { + "cargo_binstall_ghrel": { + "version": "v1.10.17", + "buildDepConfigs": {}, + "portRef": "cargo_binstall_ghrel@0.1.0", + "specifiedVersion": false + }, + "rust_rustup": { + "version": "1.83.0", + "buildDepConfigs": { + "rustup_rustlang": { + "version": "1.27.1", + "buildDepConfigs": { + "git_aa": { + "version": "2.47.0", + "buildDepConfigs": {}, + "portRef": "git_aa@0.1.0", + "specifiedVersion": false + } + }, + "portRef": "rustup_rustlang@0.1.0", + "specifiedVersion": false + } + }, + "portRef": "rust_rustup@0.1.0", + "profile": "minimal", + "specifiedVersion": false + } + }, + "portRef": "cargobi_cratesio@0.1.0", + "crateName": "tokio-console", + "specifiedVersion": false + }, + "bciqeal5okt5zj763vhgsmf3afr5thrkqaitv6pb3wwegcwyb74gdyjq": { + "version": "v1.10.17", + "buildDepConfigs": {}, + "portRef": "cargo_binstall_ghrel@0.1.0", + "specifiedVersion": false + }, + "bciqeub366wrduva4y3rxegdjkhlebwsud56e5orgcpbkdrbhuxmvuxa": { + "version": "1.83.0", + "buildDepConfigs": { + "rustup_rustlang": { + "version": "1.27.1", + "buildDepConfigs": { + "git_aa": { + "version": "2.47.0", + "buildDepConfigs": {}, + "portRef": "git_aa@0.1.0", + "specifiedVersion": false + } + }, + "portRef": "rustup_rustlang@0.1.0", + "specifiedVersion": false + } + }, + "portRef": "rust_rustup@0.1.0", + "profile": "minimal", + "specifiedVersion": false + }, + "bciqe7g5m4v5jkg3ubqhogjjntsduyrwxcirqcp6tc3jmjr5af7ojq6a": { + "version": "v2.1.2", + "buildDepConfigs": {}, + "portRef": "deno_ghrel@0.1.0", + "specifiedVersion": true } } }, @@ -270,7 +338,7 @@ "bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii", "bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji" ], - "allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq" + "allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi" }, "ghjkEnvProvInstSet____rust": { "installs": [ @@ -282,7 +350,7 @@ "bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii", "bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji" ], - "allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq" + "allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi" }, "ghjkEnvProvInstSet___dev": { "installs": [ @@ -296,7 +364,7 @@ "bciqpu4klxr3hl6ujhmflrlfd3dxp47ijq26mnathb26ojzwkeggy5ii", "bciqelae2kzmf7umbo62flzq2mnlhnc4ilbfmn4va2fzrqwx7w7zusji" ], - "allowedBuildDeps": "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq" + "allowedBuildDeps": "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi" }, "ghjkEnvProvInstSet_______task_env_cache-v8": { "installs": [], @@ -509,7 +577,7 @@ "moduleSpecifier": "file:///ports/deno_ghrel.ts" } }, - "bciqakxf4wsx3mtku4x5exrl44k4r4kyq6gaw4va5hsb3v26cipmmekq": { + "bciqdfarczmlu3r5dkvcdoultfbnuvn6saao55h4fbb3jg72kv6mkr3y": { "manifest": { "ty": "denoWorker@v1", "name": "cpy_bs_ghrel", @@ -533,7 +601,7 @@ "moduleSpecifier": "file:///ports/cpy_bs.ts" }, "defaultInst": { - "version": "3.12.7", + "version": "3.13.1", "portRef": "cpy_bs_ghrel@0.1.0" } }, @@ -805,8 +873,8 @@ "portRef": "asdf_plugin_git@0.1.0" } }, - "bciqoo3t36t4pphdox5wa5ugn34wkar7rwkqgb5l55lwnxbuabcc3nyq": { - "cpy_bs_ghrel": "bciqakxf4wsx3mtku4x5exrl44k4r4kyq6gaw4va5hsb3v26cipmmekq", + "bciqe3wvwtylh2xeobipylsfxihnx5fhjixmozyxjsn6gnwk5vikvxxi": { + "cpy_bs_ghrel": "bciqdfarczmlu3r5dkvcdoultfbnuvn6saao55h4fbb3jg72kv6mkr3y", "tar_aa": "bciqb6ua63xodzwxngnbjq35hfikiwzb3dclbqkc7e6xgjdt5jin4pia", "git_aa": "bciqfl5s36w335ducrb6f6gwb3vuwup7vzqwwg67pq42xtkngsnxqobi", "curl_aa": "bciqcfe7qyxmokpn6pgtaj35r5qg74jkehuu6cvyrtcsnegvwlm64oqy", diff --git a/ghjk.ts b/ghjk.ts index 6c209e7..1f0124b 100644 --- a/ghjk.ts +++ b/ghjk.ts @@ -11,7 +11,7 @@ import { unarchive } from "./utils/unarchive.ts"; config({ defaultEnv: "dev", enableRuntimes: true, - allowedBuildDeps: [ports.cpy_bs({ version: "3.12.7" })], + allowedBuildDeps: [ports.cpy_bs({ version: "3.13.1" })], }); env("main").vars({ diff --git a/src/ghjk/cli.rs b/src/ghjk/cli.rs index 437c7e9..40aada0 100644 --- a/src/ghjk/cli.rs +++ b/src/ghjk/cli.rs @@ -92,7 +92,7 @@ pub async fn cli() -> Res { let mut root_cmd = Cli::command(); - debug!("colleting system commands"); + debug!("collecting system commands"); let (sys_cmds, sys_actions) = match commands_from_systems(&systems).await { Ok(val) => val, diff --git a/src/ghjk/config.rs b/src/ghjk/config.rs index 767e456..619a231 100644 --- a/src/ghjk/config.rs +++ b/src/ghjk/config.rs @@ -248,9 +248,14 @@ hash.json", }; } if let Some(path) = repo_root { - self.repo_root = deno_core::resolve_url_or_path(&path, cwd) - .map_err(|err| ferr!(Box::new(err))) - .wrap_err("error resolving repo_root")?; + self.repo_root = dbg!( + deno_core::resolve_url_or_path(&path, cwd) + .map_err(|err| ferr!(Box::new(err))) + .wrap_err("error resolving repo_root")?, + &path, + cwd + ) + .0; } Ok(()) } diff --git a/src/ghjk/log.rs b/src/ghjk/log.rs index bbb3b7c..3f4a8c5 100644 --- a/src/ghjk/log.rs +++ b/src/ghjk/log.rs @@ -84,14 +84,14 @@ Args: {args:?} let filter = tracing_subscriber::EnvFilter::from_default_env(); tracing_subscriber::registry() - .with(console_subscriber::spawn()) - // filter on values from RUST_LOG - .with(filter) - // subscriber that emits to stderr - .with(fmt) - // instrument errors with SpanTraces, used by color-eyre - .with(tracing_error::ErrorLayer::default()) - .init(); + .with(console_subscriber::spawn()) + // filter on values from RUST_LOG + .with(filter) + // subscriber that emits to stderr + .with(fmt) + // instrument errors with SpanTraces, used by color-eyre + .with(tracing_error::ErrorLayer::default()) + .init(); // console_subscriber::init(); }); } diff --git a/src/ghjk/systems/deno.rs b/src/ghjk/systems/deno.rs index a393c85..5c38424 100644 --- a/src/ghjk/systems/deno.rs +++ b/src/ghjk/systems/deno.rs @@ -141,15 +141,20 @@ pub async fn systems_from_deno( let dcx = gcx.deno.clone(); let join_exit_code_watcher = tokio::spawn(async { - let err = match exit_code_channel.await.expect_or_log("channel error") { - Ok(0) => return Ok(()), - Ok(exit_code) => { + let err = match exit_code_channel.await { + Ok(Ok(0)) => return Ok(()), + Ok(Ok(exit_code)) => { ferr!("deno systems died with non-zero exit code: {exit_code}") } - Err(err) => err.wrap_err("error on event loop for deno systems"), + Ok(Err(err)) => err.wrap_err("error on event loop for deno systems"), + Err(_) => { + ferr!("deno systems unexpected shutdown") + } }; error!("deno systems error: {err:?}"); - dcx.terminate().await.expect_or_log("error terminating deno worker"); + dcx.terminate() + .await + .expect_or_log("error terminating deno worker"); Err(err) }); diff --git a/tests/envs.ts b/tests/envs.ts index c9c6b74..d684a40 100644 --- a/tests/envs.ts +++ b/tests/envs.ts @@ -58,6 +58,7 @@ ghjk_deactivate [ "$GHJK_ENV" = "main" ] && exit 1022 ghjk envs cook sss +echo $? . .ghjk/envs/sss/activate.sh # by default, envs should be based on main # so they should inherit it's env vars diff --git a/tests/utils.ts b/tests/utils.ts index 87be25b..a407573 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -127,13 +127,20 @@ export async function localE2eTest(testCase: E2eTestCase) { ); const ghjkExePath = $.path(import.meta.resolve("../target/debug/ghjk")); + const ghjkShimPath = await ghjkDataDir + .join("ghjk") + .writeText( + `!#/bin/sh +exec ${ghjkExePath.resolve().toString()} "$@"`, + { mode: 0o700 }, + ); const env: Record = { GHJK_AUTO_HOOK: "true", BASH_ENV: `${ghjkDataDir.toString()}/env.bash`, ZDOTDIR: ghjkDataDir.toString(), GHJK_DATA_DIR: ghjkDataDir.toString(), - PATH: `${ghjkExePath.parentOrThrow().toString()}:${Deno.env.get("PATH")}`, + PATH: `${ghjkShimPath.parentOrThrow().toString()}:${Deno.env.get("PATH")}`, HOME: tmpDir.toString(), GHJK_REPO_ROOT: import.meta.resolve("../"), // share the system's deno cache @@ -151,11 +158,11 @@ export async function localE2eTest(testCase: E2eTestCase) { shellsToHook: [], }); - await $`${ghjkExePath} print config` + await $`ghjk print config` .cwd(tmpDir.toString()) .clearEnv() .env(env); - await $`${ghjkExePath} envs cook` + await $`ghjk envs cook` .cwd(tmpDir.toString()) .clearEnv() .env(env);