From 0add47d9ef02988a86710fe8f5ee96c10328f926 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 21 Feb 2024 16:43:52 +0100 Subject: [PATCH] Update MetaCall and dependencies to the latest version of Guix. --- Dockerfile | 2 +- Makefile | 2 +- channels/channels.scm | 7 +- scripts/build.sh | 2 +- scripts/deps.sh | 4 +- source/metacall.scm | 156 +++++++++++++++++++----------------- tests/c/Dockerfile | 25 +++--- tests/c/test.c | 2 +- tests/cli/Dockerfile | 27 +++---- tests/node/Dockerfile | 23 +++--- tests/node/test.js | 2 +- tests/python/Dockerfile | 22 +++-- tests/python/script.py | 2 +- tests/scripts/fib.ts | 2 +- tests/scripts/mult.rb | 2 +- tests/scripts/say.cs | 2 +- tests/scripts/sum.py | 2 +- tests/tsx/Dockerfile | 23 ++---- tests/typescript/Dockerfile | 23 +++--- 19 files changed, 160 insertions(+), 170 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2adafc6..6481a20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile index b148b6e..53b6b28 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/channels/channels.scm b/channels/channels.scm index 61b7fdc..74d6a69 100644 --- a/channels/channels.scm +++ b/channels/channels.scm @@ -2,7 +2,7 @@ ; MetaCall Distributable by Parra Studios ; Distributable infrastructure for MetaCall. ; -; Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +; Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. @@ -17,9 +17,12 @@ ; limitations under the License. ; + + + (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") (branch "master") - (commit "6311493d7a6271bfbc51f4693857f9a12fe9965d")) ; Wed Apr 5 18:17:00 2023 +0200 + (commit "67960be52e01f8bd169dcff5985c4af2c5f87f91")) ; Fri Feb 16 11:18:47 2024 +0100 ) diff --git a/scripts/build.sh b/scripts/build.sh index 008fd47..52f94e5 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,7 +4,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. diff --git a/scripts/deps.sh b/scripts/deps.sh index 074e033..64060f9 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -4,7 +4,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. @@ -30,6 +30,6 @@ export GUILE_WARN_DEPRECATED='detailed' `# Build` && guix build --fallback \ nss-certs \ `# dotnet codeanalysis-csharp codeanalysis-common codeanalysis-analyzers` \ - espree typescript libnode-lts \ + espree typescript \ -L /metacall/nonguix -L /metacall/source \ `# Exit` && exit 0 || exit 1 diff --git a/source/metacall.scm b/source/metacall.scm index c95298c..642eace 100644 --- a/source/metacall.scm +++ b/source/metacall.scm @@ -2,7 +2,7 @@ ; MetaCall Distributable by Parra Studios ; Distributable infrastructure for MetaCall. ; -; Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +; Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. @@ -77,19 +77,6 @@ #:use-module (gnu packages curl) ) -; NodeJS Loader Dependencies -(define-public libnode-lts - (package/inherit node-lts - (name "libnode-lts") - (arguments - (substitute-keyword-arguments (package-arguments node-lts) - ((#:configure-flags flags ''()) - `(cons* "--shared" "--without-npm" ,flags)) - ((#:phases phases '%standard-phases) - `(modify-phases ,phases - (delete 'install-npmrc) - (delete 'patch-nested-shebangs))))))) - (define-public espree (package (name "espree") @@ -245,20 +232,17 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; ) ; ) -; TODO: MetaCall CLI should set some enviroment variables in order to make it work for Guixers -; See metacall/install CLI script for knowing the needed variables and paths - ; MetaCall (define-public metacall (package (name "metacall") - (version "0.6.2") + (version "0.7.8") (source (origin (method url-fetch) (uri (string-append "https://github.com/metacall/core/archive/v" version ".tar.gz")) - (sha256 (base32 "1hrvjk39n7lywndjnj58ch498jv429a5hf9dy9jsgw1l1k90i3dj")))) + (sha256 (base32 "0p61l4dbw0ri4vsyfri2j2vl41kfz3drv21aychp7qnqjpp1i69f")))) (build-system cmake-build-system) (arguments @@ -272,25 +256,6 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc (let ((out (assoc-ref outputs "out"))) (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib")) #t))) - (add-before 'configure 'ruby-workaround - (lambda* (#:key inputs #:allow-other-keys) - ; For some reason, FindRuby.cmake is working anymore, patch here - ; the lib and include paths here directly meanwhile the problem is solved - (substitute* "source/loaders/rb_loader/CMakeLists.txt" - (("\\$\\{Ruby_INCLUDE_DIRS\\}") (string-append - (assoc-ref inputs "ruby") "/include/ruby-2.7.0" "\n" - (assoc-ref inputs "ruby") "/include/ruby-2.7.0/" - ,(or (%current-target-system) (%current-system)))) - (("\\$\\{Ruby_LIBRARY\\}") (string-append - (assoc-ref inputs "ruby") "/lib/libruby.so"))) - (substitute* "source/ports/rb_port/CMakeLists.txt" - (("\\$\\{Ruby_INCLUDE_DIRS\\}") (string-append - (assoc-ref inputs "ruby") "/include/ruby-2.7.0" "\n" - (assoc-ref inputs "ruby") "/include/ruby-2.7.0/" - ,(or (%current-target-system) (%current-system)))) - (("\\$\\{Ruby_LIBRARY\\}") (string-append - (assoc-ref inputs "ruby") "/lib/libruby.so"))) - #t)) ; TODO ; (add-before 'configure 'dotnet-packages ; (lambda* (#:key inputs #:allow-other-keys) @@ -301,14 +266,19 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; (setenv "NUGET_PACKAGES" global-pkgs) ; (setenv "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" "true") ; (setenv "HOME" "/tmp") -; (setenv "DOTNET_ROOT" (string-append (assoc-ref inputs "dotnet") "/share/dotnet")) +; (setenv "DOTNET_ROOT" +; (string-append (assoc-ref inputs "dotnet") "/share/dotnet")) ; (mkdir-p global-pkgs) ; (mkdir-p additional-pkgs) ; ; TODO: Avoid harcoded versions of CodeAnalysis -; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-csharp") "/microsoft.codeanalysis.csharp.3.2.1.nupkg") additional-pkgs) -; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-common") "/microsoft.codeanalysis.common.3.2.1.nupkg") additional-pkgs) -; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-analyzers") "/microsoft.codeanalysis.analyzers.2.9.3.nupkg") additional-pkgs) -; (with-output-to-file "source/loaders/cs_loader/netcore/source/NuGet.Config" +; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-csharp") +; "/microsoft.codeanalysis.csharp.3.2.1.nupkg") additional-pkgs) +; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-common") +; "/microsoft.codeanalysis.common.3.2.1.nupkg") additional-pkgs) +; (invoke "cp" (string-append (assoc-ref inputs "codeanalysis-analyzers") +; "/microsoft.codeanalysis.analyzers.2.9.3.nupkg") additional-pkgs) +; (with-output-to-file +; "source/loaders/cs_loader/netcore/source/NuGet.Config" ; (lambda () ; (format #t " ; @@ -327,14 +297,16 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc (add-after 'build 'build-node-loader-bootstrap-espree (lambda* (#:key inputs #:allow-other-keys) (let* ((output (string-append (getcwd) "/node_modules/espree")) - (espree (string-append (assoc-ref inputs "espree") "/lib/node_modules/espree"))) + (espree (string-append + (assoc-ref inputs "espree") "/lib/node_modules/espree"))) (mkdir-p output) (copy-recursively espree output)) #t)) (add-after 'build 'build-ts-loader-bootstrap-typescript (lambda* (#:key inputs #:allow-other-keys) (let* ((output (string-append (getcwd) "/node_modules/typescript")) - (typescript (string-append (assoc-ref inputs "typescript") "/lib/node_modules/typescript"))) + (typescript (string-append + (assoc-ref inputs "typescript") "/lib/node_modules/typescript"))) (mkdir-p output) (copy-recursively typescript output)) #t))) @@ -351,7 +323,8 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; Build wiht release mode "-DCMAKE_BUILD_TYPE=Release" - ; Disable stack-smashing protection and source fortify in order to improve libc portability / compatibility + ; Disable stack-smashing protection and source fortify + ; in order to improve libc portability / compatibility "-DOPTION_BUILD_SECURITY=OFF" ; Examples @@ -389,29 +362,42 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc "-DOPTION_BUILD_LOADERS_COB=ON" "-DOPTION_BUILD_LOADERS_RPC=ON" - ; TODO: This stopped working properly, delete the 'ruby-workaround - (string-append "-DRUBY_EXECUTABLE=" (assoc-ref %build-inputs "ruby") "/bin/ruby") - (string-append "-DRUBY_INCLUDE_DIRS=" (assoc-ref %build-inputs "ruby") "/include/ruby-2.7.0") - (string-append "-DRUBY_LIBRARY=" (assoc-ref %build-inputs "ruby") "/lib/libruby.so") + ; TODO: This stopped working properly for rb_port + (string-append "-DRUBY_EXECUTABLE=" + (assoc-ref %build-inputs "ruby") "/bin/ruby") + (string-append "-DRUBY_INCLUDE_DIRS=" + (assoc-ref %build-inputs "ruby") "/include/ruby-2.7.0") + (string-append "-DRUBY_LIBRARY=" + (assoc-ref %build-inputs "ruby") "/lib/libruby.so") (string-append "-DRUBY_VERSION=" "2.7.2") - (string-append "-DNODEJS_EXECUTABLE=" (assoc-ref %build-inputs "node-lts") "/bin/node") - (string-append "-DNODEJS_INCLUDE_DIR=" (assoc-ref %build-inputs "node-lts") "/include/node") - (string-append "-DNODEJS_LIBRARY=" (assoc-ref %build-inputs "libnode-lts") "/lib/libnode.so.83") - "-DNODEJS_CMAKE_DEBUG=ON" - "-DNODEJS_SHARED_UV=ON" + (string-append "-DNodeJS_EXECUTABLE=" + (assoc-ref %build-inputs "node") "/bin/node") + (string-append "-DNodeJS_INCLUDE_DIR=" + (assoc-ref %build-inputs "node") "/include/node") + (string-append "-DNodeJS_LIBRARY=" + (assoc-ref %build-inputs "libnode") "/lib/libnode.so.108") + "-DNodeJS_CMAKE_DEBUG=ON" + "-DNodeJS_SHARED_UV=ON" ; TODO - ; (string-append "-DDOTNET_COMMAND=" (assoc-ref %build-inputs "dotnet") "/share/dotnet/dotnet") - ; (string-append "-DDOTNET_CORE_PATH=" (assoc-ref %build-inputs "dotnet") "/share/dotnet/shared/Microsoft.NETCore.App/5.0.4/") + ; (string-append "-DDOTNET_COMMAND=" + ; (assoc-ref %build-inputs "dotnet") "/share/dotnet/dotnet") + ; (string-append "-DDOTNET_CORE_PATH=" + ; (assoc-ref %build-inputs "dotnet") + ; "/share/dotnet/shared/Microsoft.NETCore.App/5.0.4/") ; "-DDOTNET_ADDITIONAL_PACKAGES=/tmp/.nuget/nupkgs/" - (string-append "-DCOBOL_EXECUTABLE=" (assoc-ref %build-inputs "gnucobol") "/bin/cobc") - (string-append "-DCOBOL_INCLUDE_DIR=" (assoc-ref %build-inputs "gnucobol") "/include") - (string-append "-DCOBOL_LIBRARY=" (assoc-ref %build-inputs "gnucobol") "/lib/libcob.so") + (string-append "-DCOBOL_EXECUTABLE=" + (assoc-ref %build-inputs "gnucobol") "/bin/cobc") + (string-append "-DCOBOL_INCLUDE_DIR=" + (assoc-ref %build-inputs "gnucobol") "/include") + (string-append "-DCOBOL_LIBRARY=" + (assoc-ref %build-inputs "gnucobol") "/lib/libcob.so") ; RPC Loader - (string-append "-DCURL_INCLUDE_DIR=" (assoc-ref %build-inputs "curl-minimal") "/include/curl") + (string-append "-DCURL_INCLUDE_DIR=" + (assoc-ref %build-inputs "curl") "/include/curl") ; TODO: Finish all loaders "-DOPTION_BUILD_SCRIPTS_JS=OFF" @@ -419,26 +405,27 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; Ports "-DOPTION_BUILD_PORTS=ON" "-DOPTION_BUILD_PORTS_PY=ON" - "-DOPTION_BUILD_PORTS_RB=ON" "-DOPTION_BUILD_PORTS_NODE=ON" "-DOPTION_BUILD_PORTS_TS=OFF" ; TODO: Not implemented yet "-DOPTION_BUILD_PORTS_CS=ON" + ; TODO: CMake Error at source/ports/rb_port/CMakeLists.txt:23 (message): + ; Ruby libraries not found + "-DOPTION_BUILD_PORTS_RB=OFF" + + ; TODO: Enable backtrace support "-DOPTION_BUILD_PLUGINS_BACKTRACE=OFF" ; Disable coverage - "-DOPTION_COVERAGE=OFF" - - ; Python Port (Swig) requires conversion between constant to non-constant char pointer - "-DCMAKE_CXX_FLAGS=-fpermissive"))) + "-DOPTION_COVERAGE=OFF"))) (propagated-inputs `( - ("python" ,python-3.9) ; Python Loader dependency + ("python" ,python-3) ; Python Loader dependency ("ruby" ,ruby-2.7) ; Ruby Loader dependency - ("node-lts" ,node-lts) ; NodeJS Loader dependency - ("libnode-lts" ,libnode-lts) ; NodeJS Loader dependency + ("node" ,node-lts) ; NodeJS Loader dependency + ("libnode" ,libnode) ; NodeJS Loader dependency ("libuv" ,libuv) ; NodeJS Loader dependency ("espree" ,espree) ; NodeJS Loader dependency ("typescript" ,typescript) ; TypeScript Loader dependency @@ -449,7 +436,7 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; ("codeanalysis-csharp" ,codeanalysis-csharp) ; NetCore Loader dependency ; ("codeanalysis-common" ,codeanalysis-common) ; NetCore Loader dependency ; ("codeanalysis-analyzers" ,codeanalysis-analyzers) ; NetCore Loader dependency - ("curl-minimal" ,curl-minimal))) ; RPC Loader Dependency + ("curl" ,curl))) ; RPC Loader Dependency (native-inputs `( @@ -457,7 +444,7 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ("swig" ,swig))) ; For building ports ; Set all environment variables for subsequent packages - (native-search-paths + (search-paths (list (search-path-specification (variable "LOADER_LIBRARY_PATH") (files '("lib"))) @@ -473,7 +460,32 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc (search-path-specification (variable "CONFIGURATION_PATH") (file-type 'regular) - (files '("configurations/global.json"))))) + (files '("configurations/global.json"))) + ; PYTHONPATH is incompatible with Guix Python + ; but we require it for tarball installation + (search-path-specification + (variable "PYTHONPATH") + (files (list (string-append + "lib/python" + (version-major+minor (package-version python-3)) + "/site-packages")))))) + + ; TODO: Implement the rest of paths for development + ; C_INCLUDE_PATH + ; CPLUS_INCLUDE_PATH + ; LIBRARY_PATH + + (native-search-paths search-paths) + + ; TODO: + ; + ; Dynamic Linker Path + ; #:use-module ((gnu packages bootstrap) #:select (glibc-dynamic-linker)) + ; + ; (search-path-specification + ; (variable "GLIBC_LD_LIBRARY_PATH") + ; (file-type 'regular) + ; (files '(glibc-dynamic-linker))) (home-page "https://metacall.io/") (synopsis "Inter-language foreign function interface call library") diff --git a/tests/c/Dockerfile b/tests/c/Dockerfile index 0abfcfb..2f447a3 100644 --- a/tests/c/Dockerfile +++ b/tests/c/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ # limitations under the License. # -FROM gcc:9.2.0 AS c_test +FROM gcc:13-bookworm AS c_test # Image descriptor LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ @@ -27,35 +27,34 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ vendor="MetaCall Inc." \ version="0.1" +SHELL ["/bin/bash", "-c"] + COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/c/test.c / COPY tests/scripts/ /scripts/ +WORKDIR /scripts + ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ + && source /gnu/etc/profile \ + && export LDLIB_PATH="`find /gnu/store/ -type f -wholename '*-glibc-*/lib/ld-*.so*' | head -n 1`" \ && export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LDLIB_PATH="`find /gnu/store/ -type f -wholename '*-glibc-*/lib/ld-*.so' | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ && cd / \ && gcc \ - -I$METACALL_PATH/include \ + -I/gnu/include \ test.c \ -B$(dirname ${LDLIB_PATH}) \ -Wl,--dynamic-linker=${LDLIB_PATH} \ - -Wl,-rpath=${METACALL_PATH}/lib \ - -L$METACALL_PATH/lib \ + -Wl,-rpath=/gnu/lib \ + -L/gnu/lib \ -lmetacall \ && ./a.out | grep \ -e 'Hello World' \ diff --git a/tests/c/test.c b/tests/c/test.c index dbc5856..f1132a9 100644 --- a/tests/c/test.c +++ b/tests/c/test.c @@ -2,7 +2,7 @@ * MetaCall Distributable by Parra Studios * Distributable infrastructure for MetaCall. * - * Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index 18abb80..b86118a 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,36 +30,33 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/scripts/ /scripts/ +WORKDIR /scripts + ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ && export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ - && ${METACALL_PATH}/metacallcli test.mock \ - && ${METACALL_PATH}/metacallcli mult.rb \ - && ${METACALL_PATH}/metacallcli sum.py \ + && source /gnu/etc/profile \ + && metacallcli test.mock \ + && metacallcli mult.rb \ + && metacallcli sum.py \ && printf "load mock test.mock\ninspect\nexit" \ - | ${METACALL_PATH}/metacallcli \ + | metacallcli \ | grep -e 'function three_str(a_str, b_str, c_str)' \ && printf "load rb mult.rb\ninspect\nexit" \ - | ${METACALL_PATH}/metacallcli \ + | metacallcli \ | grep -e 'function add(a, b)' -e 'function mult(a, b)' \ && printf "load py sum.py\ninspect\nexit" \ - | ${METACALL_PATH}/metacallcli \ + | metacallcli \ | grep -e 'function sum(a, b, c)' # | grep -e 'function sum(a, b, c)' \ # && printf "load cs say.cs\ninspect\nexit" \ -# | ${METACALL_PATH}/metacallcli || cat /root/metacall.log +# | metacallcli || cat /root/metacall.log ENTRYPOINT ["sh", "-c"] diff --git a/tests/node/Dockerfile b/tests/node/Dockerfile index 841e90d..82ef3e3 100644 --- a/tests/node/Dockerfile +++ b/tests/node/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,31 +30,26 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/scripts/ /scripts/ COPY tests/node/test.js /scripts/ +WORKDIR /scripts + ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ - && export PATH="/gnu/bin:${PATH}" \ - && npm install metacall - -RUN export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ + && source /gnu/etc/profile \ + && npm install metacall \ + && export LOADER_SCRIPT_PATH="/scripts/" \ && export NODE_ENV=debug \ - && printf 'load node test.js\ncall mock()\nexit' | ${METACALL_PATH}/metacallcli \ + && printf 'load node test.js\ncall mock()\nexit' | metacallcli \ | grep \ -e 'Hello World' \ - && printf 'load node test.js\ncall python()\nexit' | ${METACALL_PATH}/metacallcli \ + && printf 'load node test.js\ncall python()\nexit' | metacallcli \ | grep \ -e '366667' diff --git a/tests/node/test.js b/tests/node/test.js index 41234c4..ecba7bc 100644 --- a/tests/node/test.js +++ b/tests/node/test.js @@ -4,7 +4,7 @@ * MetaCall Distributable by Parra Studios * Distributable infrastructure for MetaCall. * - * Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tests/python/Dockerfile b/tests/python/Dockerfile index 87b88c1..7a83ac3 100644 --- a/tests/python/Dockerfile +++ b/tests/python/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,27 +30,23 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/scripts/ /scripts/ COPY tests/python/script.py /scripts/ +WORKDIR /scripts + ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ - && export PATH="/gnu/bin:${PATH}" \ - && /gnu/bin/pip3 install metacall - -RUN export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ - && printf 'load py script.py\ninspect\ncall test()\nexit' | ${METACALL_PATH}/metacallcli \ + && source /gnu/etc/profile \ + && rm /gnu/store/4r7k7ipiaqkdf4lmnxwmbz0wx2yzygzc-python-3.10.7/lib/python3.10/site-packages/sitecustomize.py \ + && pip3 install metacall \ + && export LOADER_SCRIPT_PATH="/scripts/" \ + && printf 'load py script.py\ninspect\ncall test()\nexit' | metacallcli \ | grep \ -e 'Hello World' diff --git a/tests/python/script.py b/tests/python/script.py index 4347e45..daf2e26 100644 --- a/tests/python/script.py +++ b/tests/python/script.py @@ -4,7 +4,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/scripts/fib.ts b/tests/scripts/fib.ts index bc20451..285f8ee 100644 --- a/tests/scripts/fib.ts +++ b/tests/scripts/fib.ts @@ -2,7 +2,7 @@ * MetaCall Distributable by Parra Studios * Distributable infrastructure for MetaCall. * -* Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +* Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tests/scripts/mult.rb b/tests/scripts/mult.rb index 10b7fb3..db145f6 100644 --- a/tests/scripts/mult.rb +++ b/tests/scripts/mult.rb @@ -4,7 +4,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/scripts/say.cs b/tests/scripts/say.cs index aef8864..bf84ad3 100644 --- a/tests/scripts/say.cs +++ b/tests/scripts/say.cs @@ -2,7 +2,7 @@ * MetaCall Distributable by Parra Studios * Distributable infrastructure for MetaCall. * -* Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +* Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tests/scripts/sum.py b/tests/scripts/sum.py index 76d34c2..9afbd2c 100644 --- a/tests/scripts/sum.py +++ b/tests/scripts/sum.py @@ -4,7 +4,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/tsx/Dockerfile b/tests/tsx/Dockerfile index 1f87adc..3e579d4 100644 --- a/tests/tsx/Dockerfile +++ b/tests/tsx/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ # limitations under the License. # -FROM busybox:1.31.1 AS node_test +FROM busybox:1.31.1 AS tsx_test # Image descriptor LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ @@ -30,7 +30,7 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/tsx/test.tsx /scripts/ @@ -39,23 +39,16 @@ COPY tests/tsx/package.json /scripts/ COPY tests/tsx/package-lock.json /scripts/ # Needed in order to load the tsconfig.json -WORKDIR /scripts/ +WORKDIR /scripts ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ - && export PATH="/gnu/bin:${PATH}" \ - && npm install - -RUN export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ + && source /gnu/etc/profile \ + && export LOADER_SCRIPT_PATH="/scripts/" \ && export NODE_ENV=debug \ - && printf 'load ts test.tsx\ninspect\ncall hello("world")\nexit' | ${METACALL_PATH}/metacallcli \ + && npm install \ + && printf 'load ts test.tsx\ninspect\ncall hello("world")\nexit' | metacallcli \ | grep \ -e '

Hello world

' diff --git a/tests/typescript/Dockerfile b/tests/typescript/Dockerfile index 052b0bc..ccc83de 100644 --- a/tests/typescript/Dockerfile +++ b/tests/typescript/Dockerfile @@ -2,7 +2,7 @@ # MetaCall Distributable by Parra Studios # Distributable infrastructure for MetaCall. # -# Copyright (C) 2016 - 2023 Vicente Eduardo Ferrer Garcia +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ # limitations under the License. # -FROM busybox:1.31.1 AS node_test +FROM busybox:1.31.1 AS ts_test # Image descriptor LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ @@ -30,26 +30,21 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ COPY out/tarball.tar.gz / RUN cd / \ - && tar -xzf tarball.tar.gz \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ && rm tarball.tar.gz COPY tests/scripts/fib.ts /scripts/ +WORKDIR /scripts + ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ - && export PATH="/gnu/bin:${PATH}" \ - && npm install metacall - -RUN export LOADER_SCRIPT_PATH="/scripts/" \ - && export METACALL_PATH="/gnu/store/`ls /gnu/store/ | grep metacall | head -n 1`" \ - && export LOADER_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export SERIAL_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export DETOUR_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export PORT_LIBRARY_PATH="${METACALL_PATH}/lib" \ - && export CONFIGURATIONS_PATH="${METACALL_PATH}/configurations/global.json" \ + && export LOADER_SCRIPT_PATH="/scripts/" \ && export NODE_ENV=debug \ - && printf 'load ts fib.ts\ncall fibonacci(10)\nexit' | ${METACALL_PATH}/metacallcli \ + && source /gnu/etc/profile \ + && npm install metacall \ + && printf 'load ts fib.ts\ncall fibonacci(10)\nexit' | metacallcli \ | grep \ -e '89'