diff --git a/api/src/job.js b/api/src/job.js index d46120b..8c3fa79 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -156,7 +156,11 @@ class Job { '-s', '-c', '/box/submission', - '-e', + '-E', + 'HOME=/tmp', + ...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}`, @@ -175,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; diff --git a/packages/ada/2012/build.sh b/packages/ada/2012/build.sh new file mode 100755 index 0000000..ce9ec70 --- /dev/null +++ b/packages/ada/2012/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Using the precompiled binary packages from https://github.com/annexi-strayline/gnat-packs +compname="gnat-10.3.0-base.tar.xz" +curl -L "https://gnat-packs.annexi-strayline.com/x86_64-linux-gnu/gnat-10.3.0-base.tar.xz" -o $compname + +xz -cd $compname | sudo tar xP + +#curl -L "https://storage.googleapis.com/dart-archive/channels/stable/release/2.12.1/sdk/dartsdk-linux-x64-release.zip" -o dart.zip +# +#unzip dart.zip +#rm dart.zip +# +#cp -r dart-sdk/* . +#rm -rf dart-sdk +# +#chmod -R +rx bin + + diff --git a/packages/ada/2012/compile b/packages/ada/2012/compile new file mode 100644 index 0000000..53eea78 --- /dev/null +++ b/packages/ada/2012/compile @@ -0,0 +1,30 @@ +#!/bin/bash + + +# split out all units in to their own files +gnatchop $@ + +# TODO try to compile more than just the hello unit +if [ -e "test.adb" ] +then + gnatmake "test.adb" +else + echo "It looks like you don't have a \"test\" unit" +fi + + + +#case "${PISTON_LANGUAGE}" in +# ada) +# rename 's/$/\.cs/' "$@" # Add .cs extension +# csc -out:out *.cs +# ;; +# basic) +# rename 's/$/\.vb/' "$@" # Add .vb extension +# vbnc -out:out *.vb +# ;; +# *) +# echo "How did you get here? (${PISTON_LANGUAGE})" +# exit 1 +# ;; +#esac diff --git a/packages/ada/2012/environment b/packages/ada/2012/environment new file mode 100644 index 0000000..7e73169 --- /dev/null +++ b/packages/ada/2012/environment @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +#export PATH=$PWD/bin:$PATH +export PATH=/opt/gcc-fsf-gnat/bin:$PATH +export LD_LIBRARY_PATH=/opt/gcc-fsf-gnat/lib64:/opt/gcc-fsf-gnat/lib + diff --git a/packages/ada/2012/metadata.json b/packages/ada/2012/metadata.json new file mode 100644 index 0000000..518d3ec --- /dev/null +++ b/packages/ada/2012/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "ada", + "version": "2012", + "aliases": ["gnat"] +} diff --git a/packages/ada/2012/run b/packages/ada/2012/run new file mode 100644 index 0000000..26b361a --- /dev/null +++ b/packages/ada/2012/run @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +#dart run "$@" + +# assure there is only one unit in the given file +gnatchop "$1" + +numSourceFiles=$(ls -1q *.adb | wc -l) + +gnatmake "test.adb" + + + diff --git a/packages/ada/2012/test.adb b/packages/ada/2012/test.adb new file mode 100644 index 0000000..a5d3322 --- /dev/null +++ b/packages/ada/2012/test.adb @@ -0,0 +1,6 @@ + with Ada.Text_IO; + use Ada.Text_IO; + procedure Code is + begin + Put_Line ("OK"); + end Code;