From 0a5a5cc2f86941969c874ce6070eb84718788a48 Mon Sep 17 00:00:00 2001 From: Gabriel F Date: Tue, 14 Jun 2022 18:45:22 -0300 Subject: [PATCH 1/3] added hy 1.0a4 --- packages/hy/1.0a4/build.sh | 22 ++++++++++++++++++++++ packages/hy/1.0a4/environment | 1 + packages/hy/1.0a4/metadata.json | 5 +++++ packages/hy/1.0a4/run | 3 +++ packages/hy/1.0a4/test.hy | 16 ++++++++++++++++ readme.md | 1 + 6 files changed, 48 insertions(+) create mode 100644 packages/hy/1.0a4/build.sh create mode 100644 packages/hy/1.0a4/environment create mode 100644 packages/hy/1.0a4/metadata.json create mode 100644 packages/hy/1.0a4/run create mode 100644 packages/hy/1.0a4/test.hy diff --git a/packages/hy/1.0a4/build.sh b/packages/hy/1.0a4/build.sh new file mode 100644 index 0000000..3f1e9fe --- /dev/null +++ b/packages/hy/1.0a4/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz" -o python.tar.gz +tar xzf python.tar.gz --strip-components=1 +rm python.tar.gz + +./configure --prefix "$PREFIX" --with-ensurepip=install +make -j$(nproc) +make install -j$(nproc) + +cd .. + +rm -rf build + +bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib sympy +bin/pip3 install --pre hy==1.0a4 hyrule==0.1 toolz multipledispatch funcy funcy_chain pyrsistent diff --git a/packages/hy/1.0a4/environment b/packages/hy/1.0a4/environment new file mode 100644 index 0000000..977a5e8 --- /dev/null +++ b/packages/hy/1.0a4/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH diff --git a/packages/hy/1.0a4/metadata.json b/packages/hy/1.0a4/metadata.json new file mode 100644 index 0000000..fe827af --- /dev/null +++ b/packages/hy/1.0a4/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "hy", + "version": "1.0a4", + "aliases": ["hy", "hy1.0", "hy1.0a4"] +} diff --git a/packages/hy/1.0a4/run b/packages/hy/1.0a4/run new file mode 100644 index 0000000..4fd0359 --- /dev/null +++ b/packages/hy/1.0a4/run @@ -0,0 +1,3 @@ +#!/bin/bash + +hy "$@" diff --git a/packages/hy/1.0a4/test.hy b/packages/hy/1.0a4/test.hy new file mode 100644 index 0000000..d47e36b --- /dev/null +++ b/packages/hy/1.0a4/test.hy @@ -0,0 +1,16 @@ +(print (cut "abcdef" 1 4)) + +(defn test [a b [c None] [d "x"] #* e] + [a b c d e]) +(print (test 1 2)) ; => [1, 2, None, 'x', ()] +(print (test 1 2 3 4 5 6 7)) ; => [1, 2, 3, 4, (5, 6, 7)] + +(import math) +(print (math.sqrt 2)) + +(import hyrule [inc]) +(require hyrule [assoc]) +(print (list (map inc [1 2 3]))) +(setv d {}) +(assoc d "a" 1 "b" 2) +(print d) diff --git a/readme.md b/readme.md index a65ec87..de92b35 100644 --- a/readme.md +++ b/readme.md @@ -342,6 +342,7 @@ Content-Type: application/json `groovy`, `haskell`, `husk`, +`hy`, `iverilog`, `japt`, `java`, From 6ef0cdf7b4c96e71d49ae267dc905c177ede1d51 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sat, 8 Feb 2025 15:10:50 +0200 Subject: [PATCH 2/3] Provide HOME in sandbox (#702) --- api/src/job.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/job.js b/api/src/job.js index d46120b..31f688d 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -156,6 +156,8 @@ class Job { '-s', '-c', '/box/submission', + '-E', + 'HOME=/tmp', '-e', `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, From 1d55a41a2d563318388596b46d7da772027339ba Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sat, 8 Feb 2025 20:46:46 +0200 Subject: [PATCH 3/3] Explicitly provide env vars instead of inheriting them from parent (#703) --- api/src/job.js | 8 +++----- api/src/runtime.js | 10 +--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 31f688d..8c3fa79 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -158,7 +158,9 @@ class Job { '/box/submission', '-E', 'HOME=/tmp', - '-e', + ...this.runtime.env_vars.flat_map(v => ['-E', v]), + '-E', + `PISTON_LANGUAGE=${this.runtime.language}`, `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, `--processes=${this.runtime.max_process_count}`, @@ -177,10 +179,6 @@ class Job { ...args, ], { - env: { - ...this.runtime.env_vars, - PISTON_LANGUAGE: this.runtime.language, - }, stdio: 'pipe', } ); diff --git a/api/src/runtime.js b/api/src/runtime.js index 9a2adf4..90a2225 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -178,15 +178,7 @@ class Runtime { const env_file = path.join(this.pkgdir, '.env'); const env_content = fss.read_file_sync(env_file).toString(); - this._env_vars = {}; - - env_content - .trim() - .split('\n') - .map(line => line.split('=', 2)) - .forEach(([key, val]) => { - this._env_vars[key.trim()] = val.trim(); - }); + this._env_vars = env_content.trim().split('\n'); } return this._env_vars;