From ca109128b745bfda42de4e01bab50e2f6d4eedbf Mon Sep 17 00:00:00 2001 From: "Vargas, Dan" Date: Fri, 19 Mar 2021 13:45:59 -0500 Subject: [PATCH 01/20] pkg(clojure-1.10.3): Add clojure 1.10.3 --- packages/clojure/1.10.3/build.sh | 43 +++++++++++++++++++++++++++ packages/clojure/1.10.3/environment | 6 ++++ packages/clojure/1.10.3/metadata.json | 6 ++++ packages/clojure/1.10.3/run | 4 +++ packages/clojure/1.10.3/test.clj | 5 ++++ 5 files changed, 64 insertions(+) create mode 100755 packages/clojure/1.10.3/build.sh create mode 100644 packages/clojure/1.10.3/environment create mode 100644 packages/clojure/1.10.3/metadata.json create mode 100644 packages/clojure/1.10.3/run create mode 100644 packages/clojure/1.10.3/test.clj diff --git a/packages/clojure/1.10.3/build.sh b/packages/clojure/1.10.3/build.sh new file mode 100755 index 0000000..4633daf --- /dev/null +++ b/packages/clojure/1.10.3/build.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Installation location +PREFIX=$(realpath $(dirname $0)) + +# Clojure depends on Java (build and runtime) +mkdir -p java +cd java +curl "https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz" -o java.tar.gz +tar xzf java.tar.gz --strip-components=1 +rm java.tar.gz +cd .. + +# Clojure depends on Maven (build) +mkdir -p maven +cd maven +curl "https://apache.claz.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz" -o maven.tar.gz +tar xzf maven.tar.gz --strip-components=1 +rm maven.tar.gz +cd .. + +# Adding java and maven to the path for building +export PATH=$PWD/java/bin:$PWD/maven/bin:$PATH +export JAVA_HOME=$PWD/java + +# Clojure download +mkdir -p build +cd build +git clone -q "https://github.com/clojure/clojure.git" . +git checkout -b clojure-1.10.3 aaf73b12467df80f5db3e086550a33fee0e1b39e # commit for 1.10.3 release + +# Build using maven +mvn -Plocal -Dmaven.test.skip=true package + +# Get ridda that m2 bloat from Maven and remove Maven itself +cd ../ +rm -rf ~/.m2 +rm -rf maven/ + +# Move the jar for easier reference and cleanup +mkdir -p bin +mv build/clojure.jar bin +rm -rf build diff --git a/packages/clojure/1.10.3/environment b/packages/clojure/1.10.3/environment new file mode 100644 index 0000000..e7ef3b1 --- /dev/null +++ b/packages/clojure/1.10.3/environment @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Clojure requires JAVA_HOME to be set and java binary to be in the path +export JAVA_HOME=$PWD/java +export CLOJURE_PATH=$PWD/bin +export PATH=$PWD/java/bin:$PATH diff --git a/packages/clojure/1.10.3/metadata.json b/packages/clojure/1.10.3/metadata.json new file mode 100644 index 0000000..64f83fa --- /dev/null +++ b/packages/clojure/1.10.3/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "clojure", + "version": "1.10.3", + "aliases": ["clojure","clj"], + "author": "Dan Vargas " +} diff --git a/packages/clojure/1.10.3/run b/packages/clojure/1.10.3/run new file mode 100644 index 0000000..a8901af --- /dev/null +++ b/packages/clojure/1.10.3/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Run clojure with Java referencing the clojure jar location +java -jar $CLOJURE_PATH/clojure.jar "$@" diff --git a/packages/clojure/1.10.3/test.clj b/packages/clojure/1.10.3/test.clj new file mode 100644 index 0000000..7f50202 --- /dev/null +++ b/packages/clojure/1.10.3/test.clj @@ -0,0 +1,5 @@ +(ns clojure.examples.main + (:gen-class)) +(defn main [] + (println "OK")) +(main) \ No newline at end of file From d032caa9bcd013af84e3a2c1d22dc5edb528b754 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 12:35:36 +1300 Subject: [PATCH 02/20] pkg(brainfuck-2.7.3): use older commit --- packages/brainfuck/2.7.3/build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/brainfuck/2.7.3/build.sh b/packages/brainfuck/2.7.3/build.sh index 796b573..4863c8b 100644 --- a/packages/brainfuck/2.7.3/build.sh +++ b/packages/brainfuck/2.7.3/build.sh @@ -6,6 +6,9 @@ PREFIX=$(realpath $(dirname $0)) git clone https://github.com/fabianishere/brainfuck.git cd brainfuck +git checkout 6ea0f173989df4d5ce698e1f3c95f2cd0535ebd1 + + mkdir -p build cd build From 538d3d34512f83f2b32de34eb9ad7d4bcf603479 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 12:37:55 +1300 Subject: [PATCH 03/20] pkg(brainfuck-2.7.3): go back further in time --- packages/brainfuck/2.7.3/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/brainfuck/2.7.3/build.sh b/packages/brainfuck/2.7.3/build.sh index 4863c8b..50c1868 100644 --- a/packages/brainfuck/2.7.3/build.sh +++ b/packages/brainfuck/2.7.3/build.sh @@ -6,7 +6,7 @@ PREFIX=$(realpath $(dirname $0)) git clone https://github.com/fabianishere/brainfuck.git cd brainfuck -git checkout 6ea0f173989df4d5ce698e1f3c95f2cd0535ebd1 +git checkout 06f84462e0a96487670a4b8024e3ec531e0377ee mkdir -p build From 947bc35304cb81a00794bdf887dfbc767938a8cf Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 12:55:07 +1300 Subject: [PATCH 04/20] pkg(python-*): Install common packages within python --- packages/python/2.7.18/build.sh | 2 +- packages/python/3.5.10/build.sh | 2 +- packages/python/3.9.1/build.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index 1cc8e23..28a93e6 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build - +bin/pip2 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib diff --git a/packages/python/3.5.10/build.sh b/packages/python/3.5.10/build.sh index 445f96a..d02faf4 100755 --- a/packages/python/3.5.10/build.sh +++ b/packages/python/3.5.10/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build - +bin/pip3 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib diff --git a/packages/python/3.9.1/build.sh b/packages/python/3.9.1/build.sh index ec2a2d5..03fab6f 100755 --- a/packages/python/3.9.1/build.sh +++ b/packages/python/3.9.1/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build - +bin/pip3 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib From aa885a37ad8cf2fdae675be1c7a29fa85f619e68 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:03:33 +1300 Subject: [PATCH 05/20] pkg(python-*): remove llvm dependency through numba --- packages/python/2.7.18/build.sh | 2 +- packages/python/3.5.10/build.sh | 2 +- packages/python/3.9.1/build.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index 28a93e6..d973d04 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build -bin/pip2 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib +bin/pip2 install numpy scipy pandas pycrypto whoosh bcrypt passlib diff --git a/packages/python/3.5.10/build.sh b/packages/python/3.5.10/build.sh index d02faf4..bced203 100755 --- a/packages/python/3.5.10/build.sh +++ b/packages/python/3.5.10/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build -bin/pip3 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib +bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib diff --git a/packages/python/3.9.1/build.sh b/packages/python/3.9.1/build.sh index 03fab6f..fcae7c7 100755 --- a/packages/python/3.9.1/build.sh +++ b/packages/python/3.9.1/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build -bin/pip3 install numpy scipy pandas pycrypto numba whoosh bcrypt passlib +bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib From d2f1d62d15dc24ae3dd754ad853f56d4a554d0a1 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:19:00 +1300 Subject: [PATCH 06/20] pkg(python-2.7.18): use correct package versions for py2 --- packages/python/2.7.18/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index d973d04..3cd371d 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build -bin/pip2 install numpy scipy pandas pycrypto whoosh bcrypt passlib +bin/pip2 install numpy==1.16.* scipy==1.2.* pandas==0.23.* pycrypto whoosh bcrypt==3.1.* passlib From aecfcedaba023be69beb14b644d958dc06737abb Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:30:36 +1300 Subject: [PATCH 07/20] pkg(python-2.7.18): update pip before using Pip 20.3.* respects python_requires --- packages/python/2.7.18/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index 3cd371d..68ee12d 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -17,5 +17,7 @@ make install -j$(nproc) cd .. rm -rf build +bin/pip2 install -U pip==20.3.* +# Upgrade pip to latest supported version -bin/pip2 install numpy==1.16.* scipy==1.2.* pandas==0.23.* pycrypto whoosh bcrypt==3.1.* passlib +bin/pip2 install numpy scipy pandas pycrypto whoosh bcrypt passlib From 1d4fbab57cbb2799702c0f85e10ae173714c64f8 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:34:21 +1300 Subject: [PATCH 08/20] pkg(python-2.7.18): pandas seems to not define metadata correctly --- packages/python/2.7.18/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index 68ee12d..8e0fd2e 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -20,4 +20,4 @@ rm -rf build bin/pip2 install -U pip==20.3.* # Upgrade pip to latest supported version -bin/pip2 install numpy scipy pandas pycrypto whoosh bcrypt passlib +bin/pip2 install numpy scipy pandas==0.23.* pycrypto whoosh bcrypt passlib From d85f1d2c5bfe676051aae1a3709795f98584d782 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:37:48 +1300 Subject: [PATCH 09/20] pkg(python-2.7.18): pandas just doesn't like py2? --- packages/python/2.7.18/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/2.7.18/build.sh b/packages/python/2.7.18/build.sh index 8e0fd2e..131ba96 100755 --- a/packages/python/2.7.18/build.sh +++ b/packages/python/2.7.18/build.sh @@ -20,4 +20,4 @@ rm -rf build bin/pip2 install -U pip==20.3.* # Upgrade pip to latest supported version -bin/pip2 install numpy scipy pandas==0.23.* pycrypto whoosh bcrypt passlib +bin/pip2 install numpy scipy pycrypto whoosh bcrypt passlib From 332a077f469a763592660eaf1b30a808d5be1b43 Mon Sep 17 00:00:00 2001 From: Shivansh-007 Date: Sat, 20 Mar 2021 06:16:54 +0530 Subject: [PATCH 10/20] pkg(vlang-0.1.13): Add vlang 0.1.13 (#177) * pkg(vlang-0.1.13): Add vlang 0.1.13 * Export environment variables: VMODULES and TMPDIR environment vars to the current working dir in the run script. Co-authored-by: Shivansh-007 --- packages/vlang/0.1.13/build.sh | 8 ++++++++ packages/vlang/0.1.13/environment | 4 ++++ packages/vlang/0.1.13/metadata.json | 6 ++++++ packages/vlang/0.1.13/run | 8 ++++++++ packages/vlang/0.1.13/test.v | 3 +++ 5 files changed, 29 insertions(+) create mode 100755 packages/vlang/0.1.13/build.sh create mode 100644 packages/vlang/0.1.13/environment create mode 100644 packages/vlang/0.1.13/metadata.json create mode 100644 packages/vlang/0.1.13/run create mode 100644 packages/vlang/0.1.13/test.v diff --git a/packages/vlang/0.1.13/build.sh b/packages/vlang/0.1.13/build.sh new file mode 100755 index 0000000..127bac9 --- /dev/null +++ b/packages/vlang/0.1.13/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Cloning vlang source +git clone https://github.com/vlang/v +cd v + +# Building and installing vlang +make \ No newline at end of file diff --git a/packages/vlang/0.1.13/environment b/packages/vlang/0.1.13/environment new file mode 100644 index 0000000..638b0c2 --- /dev/null +++ b/packages/vlang/0.1.13/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH="$PWD/v:$PATH" \ No newline at end of file diff --git a/packages/vlang/0.1.13/metadata.json b/packages/vlang/0.1.13/metadata.json new file mode 100644 index 0000000..855f7bb --- /dev/null +++ b/packages/vlang/0.1.13/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "vlang", + "version": "0.1.13", + "author": "Shivansh-007 ", + "aliases": ["v"] +} diff --git a/packages/vlang/0.1.13/run b/packages/vlang/0.1.13/run new file mode 100644 index 0000000..d8fa7b2 --- /dev/null +++ b/packages/vlang/0.1.13/run @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Export environment variables +export VMODULES="$PWD" +export TMPDIR="$PWD" + +# Put instructions to run the runtime +v run "$@" \ No newline at end of file diff --git a/packages/vlang/0.1.13/test.v b/packages/vlang/0.1.13/test.v new file mode 100644 index 0000000..fb5de5e --- /dev/null +++ b/packages/vlang/0.1.13/test.v @@ -0,0 +1,3 @@ +fn main() { + println('OK') +} \ No newline at end of file From 96fd2d0102abcd5ec827672eb57b0523e60bc061 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:49:14 +1300 Subject: [PATCH 11/20] repo: add libgmp --- repo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/Dockerfile b/repo/Dockerfile index be968fa..450aaa5 100644 --- a/repo/Dockerfile +++ b/repo/Dockerfile @@ -1,6 +1,6 @@ FROM debian:buster-slim -RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip && \ +RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip libgmp-dev && \ ln -sf /bin/bash /bin/sh && \ rm -rf /var/lib/apt/lists/* From c4a4811b17461fdc4f21029b1d9edffdc5079a8f Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 13:59:57 +1300 Subject: [PATCH 12/20] repo: add libmpfr --- repo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/Dockerfile b/repo/Dockerfile index 450aaa5..d628b2e 100644 --- a/repo/Dockerfile +++ b/repo/Dockerfile @@ -1,6 +1,6 @@ FROM debian:buster-slim -RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip libgmp-dev && \ +RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip libgmp-dev libmpfr-dev && \ ln -sf /bin/bash /bin/sh && \ rm -rf /var/lib/apt/lists/* From 6d04cc168030acaa7aeacfcd8a3bbe566133e7cf Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 14:26:57 +1300 Subject: [PATCH 13/20] repo: install py2 in build container --- repo/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/Dockerfile b/repo/Dockerfile index d628b2e..a4fcf0a 100644 --- a/repo/Dockerfile +++ b/repo/Dockerfile @@ -1,6 +1,6 @@ FROM debian:buster-slim -RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip libgmp-dev libmpfr-dev && \ +RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep libncurses5-dev libncursesw5-dev python3-pip libgmp-dev libmpfr-dev python2 && \ ln -sf /bin/bash /bin/sh && \ rm -rf /var/lib/apt/lists/* From 7ad8f337bc2eeda6f0b15e52d211afa371a359f1 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 14:39:59 +1300 Subject: [PATCH 14/20] pkg(dotnet-5.0.201): Add dotnet 5.0.201 support --- packages/dotnet/5.0.201/build.sh | 6 ++++++ packages/dotnet/5.0.201/compile | 5 +++++ packages/dotnet/5.0.201/environment | 5 +++++ packages/dotnet/5.0.201/metadata.json | 6 ++++++ packages/dotnet/5.0.201/run | 5 +++++ packages/dotnet/5.0.201/test.cs | 9 +++++++++ 6 files changed, 36 insertions(+) create mode 100644 packages/dotnet/5.0.201/build.sh create mode 100644 packages/dotnet/5.0.201/compile create mode 100644 packages/dotnet/5.0.201/environment create mode 100644 packages/dotnet/5.0.201/metadata.json create mode 100644 packages/dotnet/5.0.201/run create mode 100644 packages/dotnet/5.0.201/test.cs diff --git a/packages/dotnet/5.0.201/build.sh b/packages/dotnet/5.0.201/build.sh new file mode 100644 index 0000000..cd72067 --- /dev/null +++ b/packages/dotnet/5.0.201/build.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +curl "https://download.visualstudio.microsoft.com/download/pr/73a9cb2a-1acd-4d20-b864-d12797ca3d40/075dbe1dc3bba4aa85ca420167b861b6/dotnet-sdk-5.0.201-linux-x64.tar.gz" -Lo dotnet.tar.gz +tar xzf dotnet.tar.gz --strip-components=1 +rm dotnet.tar.gz + diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile new file mode 100644 index 0000000..9a0ea83 --- /dev/null +++ b/packages/dotnet/5.0.201/compile @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +dotnet new console +rm Program.cs +dotnet build -o . \ No newline at end of file diff --git a/packages/dotnet/5.0.201/environment b/packages/dotnet/5.0.201/environment new file mode 100644 index 0000000..34d0bbb --- /dev/null +++ b/packages/dotnet/5.0.201/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export DOTNET_ROOT=$PWD +export PATH=$DOTNET_ROOT:$PATH diff --git a/packages/dotnet/5.0.201/metadata.json b/packages/dotnet/5.0.201/metadata.json new file mode 100644 index 0000000..72f2e79 --- /dev/null +++ b/packages/dotnet/5.0.201/metadata.json @@ -0,0 +1,6 @@ +{ + "language": "dotnet", + "version": "5.0.201", + "aliases": ["cs", "csharp"], + "author": "Thomas Hobson " +} diff --git a/packages/dotnet/5.0.201/run b/packages/dotnet/5.0.201/run new file mode 100644 index 0000000..1739d03 --- /dev/null +++ b/packages/dotnet/5.0.201/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +shift +dotnet $(basename $(realpath .)).dll "$@" \ No newline at end of file diff --git a/packages/dotnet/5.0.201/test.cs b/packages/dotnet/5.0.201/test.cs new file mode 100644 index 0000000..e91a2a2 --- /dev/null +++ b/packages/dotnet/5.0.201/test.cs @@ -0,0 +1,9 @@ +using System; + +public class Test +{ + public static void Main(string[] args) + { + Console.WriteLine("OK"); + } +} \ No newline at end of file From 91018d6d8513f5062ffe2c27ccdc2bdcaaa3a222 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 15:17:55 +1300 Subject: [PATCH 15/20] pkg(dotnet-5.0.201): Nuget caching --- packages/dotnet/5.0.201/build.sh | 8 ++++++++ packages/dotnet/5.0.201/compile | 11 +++++++++-- packages/dotnet/5.0.201/environment | 2 +- packages/dotnet/5.0.201/run | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/dotnet/5.0.201/build.sh b/packages/dotnet/5.0.201/build.sh index cd72067..9093a3a 100644 --- a/packages/dotnet/5.0.201/build.sh +++ b/packages/dotnet/5.0.201/build.sh @@ -4,3 +4,11 @@ curl "https://download.visualstudio.microsoft.com/download/pr/73a9cb2a-1acd-4d20 tar xzf dotnet.tar.gz --strip-components=1 rm dotnet.tar.gz +# Cache nuget packages +export DOTNET_CLI_HOME=$PWD +dotnet new console -o cache_application +# This calls a restore on the global-packages index ($DOTNET_CLI_HOME/.nuget/packages) +# If we want to allow more packages, we could add them to this cache_application + +rm -rf cache_application +# Get rid of it, we don't actually need the application - just the restore \ No newline at end of file diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile index 9a0ea83..d92c7a9 100644 --- a/packages/dotnet/5.0.201/compile +++ b/packages/dotnet/5.0.201/compile @@ -1,5 +1,12 @@ #!/usr/bin/env bash -dotnet new console +export DOTNET_CLI_HOME=$PWD + +dotnet build > /dev/null # Shut the thing up + +dotnet new console -o . --no-restore rm Program.cs -dotnet build -o . \ No newline at end of file + +dotnet restore --source $DOTNET_ROOT/.nuget/packages + +dotnet build -o . --no-restore \ No newline at end of file diff --git a/packages/dotnet/5.0.201/environment b/packages/dotnet/5.0.201/environment index 34d0bbb..596d56e 100644 --- a/packages/dotnet/5.0.201/environment +++ b/packages/dotnet/5.0.201/environment @@ -2,4 +2,4 @@ # Put 'export' statements here for environment variables export DOTNET_ROOT=$PWD -export PATH=$DOTNET_ROOT:$PATH +export PATH=$DOTNET_ROOT:$PATH \ No newline at end of file diff --git a/packages/dotnet/5.0.201/run b/packages/dotnet/5.0.201/run index 1739d03..40495e0 100644 --- a/packages/dotnet/5.0.201/run +++ b/packages/dotnet/5.0.201/run @@ -1,5 +1,7 @@ #!/usr/bin/env bash # Put instructions to run the runtime +export DOTNET_CLI_HOME=$PWD + shift dotnet $(basename $(realpath .)).dll "$@" \ No newline at end of file From c01d8e1c55956221ef45fc43d4fe161bd5782534 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 15:19:41 +1300 Subject: [PATCH 16/20] pkg(dotnet-5.0.201): call the correect dotnet binary --- packages/dotnet/5.0.201/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dotnet/5.0.201/build.sh b/packages/dotnet/5.0.201/build.sh index 9093a3a..c685668 100644 --- a/packages/dotnet/5.0.201/build.sh +++ b/packages/dotnet/5.0.201/build.sh @@ -6,7 +6,7 @@ rm dotnet.tar.gz # Cache nuget packages export DOTNET_CLI_HOME=$PWD -dotnet new console -o cache_application +./dotnet new console -o cache_application # This calls a restore on the global-packages index ($DOTNET_CLI_HOME/.nuget/packages) # If we want to allow more packages, we could add them to this cache_application From cbe759ab5667e91ecbdd5f3a2b92e1663e3ae6df Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 15:57:29 +1300 Subject: [PATCH 17/20] pkg(dotnet-5.0.201): fix builds --- packages/dotnet/5.0.201/compile | 6 +++--- packages/dotnet/5.0.201/run | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile index d92c7a9..1500acb 100644 --- a/packages/dotnet/5.0.201/compile +++ b/packages/dotnet/5.0.201/compile @@ -1,12 +1,12 @@ #!/usr/bin/env bash export DOTNET_CLI_HOME=$PWD +export HOME=$PWD -dotnet build > /dev/null # Shut the thing up +dotnet build --help > /dev/null # Shut the thing up dotnet new console -o . --no-restore rm Program.cs dotnet restore --source $DOTNET_ROOT/.nuget/packages - -dotnet build -o . --no-restore \ No newline at end of file +dotnet build --no-restore \ No newline at end of file diff --git a/packages/dotnet/5.0.201/run b/packages/dotnet/5.0.201/run index 40495e0..774a08a 100644 --- a/packages/dotnet/5.0.201/run +++ b/packages/dotnet/5.0.201/run @@ -4,4 +4,4 @@ export DOTNET_CLI_HOME=$PWD shift -dotnet $(basename $(realpath .)).dll "$@" \ No newline at end of file +dotnet bin/Debug/net5.0/$(basename $(realpath .)).dll "$@" \ No newline at end of file From b8e79572b5c37238ccffaecbdf8fa31473410808 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 17:06:35 +1300 Subject: [PATCH 18/20] readme: update for v3 --- readme.md | 178 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 107 insertions(+), 71 deletions(-) diff --git a/readme.md b/readme.md index e671b93..d53dfa7 100644 --- a/readme.md +++ b/readme.md @@ -83,111 +83,155 @@ so we can discuss potentially getting you an unlimited key. # Getting Started +## All In One + ### Host System Package Dependencies - Docker - Docker Compose - Node JS -#### After system dependencies are installed, clone this repository: +### After system dependencies are installed, clone this repository: ```sh # clone and enter repo git clone https://github.com/engineer-man/piston ``` -#### Installation +## Just Piston (no CLI) -- docker-compose up +### Host System Package Dependencies + +- Docker + +### Installation + +```sh +echo "$GITHUB_TOKEN" | docker login https://docker.pkg.github.com -u "$GITHUB_USERNAME" --password-stdin +# Change out the $GITHUB_TOKEN and $GITHUB_USERNAME with appropritate values + +docker run -v $PWD:'/piston' --tmpfs /piston/jobs -dit -p 6969:6969 --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api:latest +``` + +### Installation + +- docker-compose up -d piston_api -#### CLI Usage -- `cli/execute [language] [file path] [args]`
# Usage ### CLI +The CLI is the main tool used for installing packages within piston, but also supports running code. + +You can execute the cli with `cli/index.js`. + ```sh -lxc/execute [language] [file path] [args] +# List all available packages +cli/index.js ppman list + +# Install python 3.9.1 +cli/index.js ppman install python 3.9.1 + +# Run a python script +echo 'print("Hello world!")' > test.py +cli/index.js run python 3.9.1 test.py +``` + +If you are operating on a remote machine, add the `-u` flag like so: + +```sh +cli/index.js -u http://piston.server:6969 ppman list ``` ### API -To use the API, it must first be started. Please note that if root is required to access -LXC then the API must also be running as root. To start the API, run the following: -``` -cd api -./start -``` +The container exposes an API on port 6969 by default. +This is used by the CLI to carry out running jobs and package managment. -For your own local installation, the API is available at: - -``` -http://127.0.0.1:2000 -``` - -#### Versions Endpoint -`GET /versions` -This endpoint will return the supported languages along with the current version and aliases. To execute -code for a particular language using the `/execute` endpoint, either the name or one of the aliases must -be provided. +#### Runtimes Endpoint +`GET /runtimes` +This endpoint will return the supported languages along with the current version, author and aliases. To execute +code for a particular language using the `/jobs` endpoint, either the name or one of the aliases must +be provided, along with the version. +Multiple versions of the same language may be present at the same time, and may be selected when running a job. ```json HTTP/1.1 200 OK Content-Type: application/json [ - { - "name": "awk", - "aliases": ["awk"], - "version": "1.3.3" - }, - { - "name": "bash", - "aliases": ["bash"], - "version": "4.4.20" - }, - { - "name": "c", - "aliases": ["c"], - "version": "7.5.0" - } + { + "language": "bash", + "version": "5.1.0", + "author": "Thomas Hobson ", + "aliases": [ + "sh" + ] + }, + { + "language": "brainfuck", + "version": "2.7.3", + "author": "Thomas Hobson ", + "aliases": [ + "bf" + ] + }, + ... ] ``` #### Execute Endpoint -`POST /execute` +`POST /jobs` This endpoint requests execution of some arbitrary code. -- `language` (**required**) The language to use for execution, must be a string and supported by Piston (see list below). -- `source` (**required**) The source code to execute, must be a string. -- `stdin` (*optional*) The text to pass as stdin to the program. Must be a string or left out of the request. -- `args` (*optional*) The arguments to pass to the program. Must be an array or left out of the request. +- `language` (**required**) The language to use for execution, must be a string and must be installed. +- `version` (**required**) The version of the language to use for execution, must be a string containing a SemVer selector for the version or the specific version number to use. +- `files` (**required**) An array of files containing code or other data that should be used for execution. +- `files[].name` (**required**) The name of the file to upload, must be a string containing no path. +- `files[].content` (**required**) The content of the files to upload, must be a string containing text to write. +- `main` (**required**) The name of one of the files provided that should be considered the main source file which will be used as the entrypoint, must be a string and be the name of a file in `files`. +- `stdin` (**required**) The text to pass as stdin to the program. Must be a string, can be left blank. +- `args` (**required**) The arguments to pass to the program. Must be an array. +- `compile_timeout` (**required**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number. +- `run_timeout` (**required**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number. + ```json { "language": "js", - "source": "console.log(process.argv)", + "version": "15.10.0", + "files":[ + { + "name": "my_cool_code.js", + "content": "console.log(process.argv)" + } + ], + "main": "my_cool_code.js", "stdin": "", "args": [ "1", "2", "3" - ] + ], + "compile_timeout": 10000, + "run_timeout": 3000 } ``` -A typical response upon successful execution will contain the `language`, `version`, `output` which -is a combination of both `stdout` and `stderr` but in chronological order according to program output, -as well as separate `stdout` and `stderr`. +A typical response upon successful execution will contain 1 or 2 keys `run` and `compile`. +`compile` will only be present if the language requested requires a compile stage. + +Each of these keys has an identical structure, containing both a `stdout` and `stderr` key, which is a string containing the text outputted during the stage into each buffer. +It also contains the `code` and `signal` which was returned from each process. ```json HTTP/1.1 200 OK Content-Type: application/json { - "ran": true, - "language": "js", - "version": "12.13.0", - "output": "[ '/usr/bin/node',\n '/tmp/code.code',\n '1',\n '2',\n '3' ]", - "stdout": "[ '/usr/bin/node',\n '/tmp/code.code',\n '1',\n '2',\n '3' ]", - "stderr": "" + "run": { + "stdout": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/9501b09d-0105-496b-b61a-e5148cf66384/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n", + "stderr": "", + "code": 0, + "signal": null + } } ``` If a problem exists with the request, a `400` status code is returned and the reason in the `message` key. @@ -196,43 +240,35 @@ HTTP/1.1 400 Bad Request Content-Type: application/json { - "message": "Supplied language is not supported by Piston" + "message": "html-5.0.0 runtime is unknown" } ```
-# Supported Languages - -`python`,`php`,`node` - - -
- +
- # License Piston is licensed under the MIT license. From cbfeef55abbd8f073776b3bf60b5ff9151847d6f Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 17:08:12 +1300 Subject: [PATCH 19/20] readme: put installation where it should be --- readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index d53dfa7..afe9a9f 100644 --- a/readme.md +++ b/readme.md @@ -98,6 +98,10 @@ so we can discuss potentially getting you an unlimited key. git clone https://github.com/engineer-man/piston ``` +### Installation + +- docker-compose up -d piston_api + ## Just Piston (no CLI) ### Host System Package Dependencies @@ -113,10 +117,6 @@ echo "$GITHUB_TOKEN" | docker login https://docker.pkg.github.com -u "$GITHUB_US docker run -v $PWD:'/piston' --tmpfs /piston/jobs -dit -p 6969:6969 --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api:latest ``` -### Installation - -- docker-compose up -d piston_api -
# Usage From e1b5b55b6997115761af23ecd4cf3a4a7d492dbe Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 17:10:53 +1300 Subject: [PATCH 20/20] readme: add cli dependencies --- readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index afe9a9f..9d1fb11 100644 --- a/readme.md +++ b/readme.md @@ -100,7 +100,14 @@ git clone https://github.com/engineer-man/piston ### Installation -- docker-compose up -d piston_api +```sh +docker-compose up -d piston_api +# Start the API container + +npm install -g yarn +cd cli && yarn && cd - +# Install all the dependencies for the cli +``` ## Just Piston (no CLI)