From cb46c39d16a6c4ab80c19ae9ad73cf25f4631e69 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 11 Aug 2024 02:48:26 +0200 Subject: [PATCH 1/5] Test script: adding configuration file for GNAT toolchains --- frontend/py_modules/code_projects/toolchain.ini | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 frontend/py_modules/code_projects/toolchain.ini diff --git a/frontend/py_modules/code_projects/toolchain.ini b/frontend/py_modules/code_projects/toolchain.ini new file mode 100644 index 000000000..0aba4d40f --- /dev/null +++ b/frontend/py_modules/code_projects/toolchain.ini @@ -0,0 +1,16 @@ +[DEFAULT] + +[toolchain_path] +root = /opt/ada +selected = /opt/ada/selected +default = /opt/ada/default + +[default_version] +gnat = 12.2.0-1 +gnatprove = 12.1.0-1 +gprbuild = 22.0.0-1 + +[toolchains] +gnat = 12.2.0-1 +gnatprove = 12.1.0-1 +gprbuild = 22.0.0-1 From f05ce0325773d867171a1bc605d73cddd991ad4f Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 11 Aug 2024 02:49:47 +0200 Subject: [PATCH 2/5] Vagrant: using toolchain information from configuration file --- Vagrantfile | 64 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index d6ef71b6a..00c4177d7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,6 +7,7 @@ $frontend = <<-SHELL # Install system deps DEBIAN_FRONTEND=noninteractive apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y \ + crudini \ python3 \ python3-pip \ python3-venv \ @@ -19,12 +20,13 @@ $frontend = <<-SHELL # Install FSF GNAT # (Required tool: gnatchop) - wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-12.2.0-1/gnat-x86_64-linux-12.2.0-1.tar.gz && \ + path_ada_toolchain_selected=$(crudini --get /home/vagrant/toolchain.ini toolchain_path selected) + wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${default_version_gnat}/gnat-x86_64-linux-${default_version_gnat}.tar.gz && \ tar xzf gnat.tar.gz && \ mv gnat-* /usr/local/gnat && \ rm *.tar.gz - echo 'export PATH="/usr/local/gnat/bin:${PATH}"' >> /home/vagrant/.bashrc + echo "export PATH=\\"${path_ada_toolchain_selected}/gnat/bin:${path_ada_toolchain_default}/gnat/bin:${PATH}\\"" >> /home/vagrant/.bashrc source /home/vagrant/.bashrc # Install learn deps @@ -53,6 +55,7 @@ $epub = <<-SHELL # Install system deps DEBIAN_FRONTEND=noninteractive apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y \ + crudini \ python3 \ python3-pip \ python3-venv \ @@ -81,47 +84,70 @@ $epub = <<-SHELL wget \ libc6-dev + # Get relevant information from configuration file + toolchain_config=home/vagrant/toolchain.ini + path_ada_toolchain_root=$(crudini --get $toolchain_config toolchain_path root) + path_ada_toolchain_selected=$(crudini --get $toolchain_config toolchain_path selected) + path_ada_toolchain_default=$(crudini --get $toolchain_config toolchain_path default) + default_version_gnat=$(crudini --get $toolchain_config default_version gnat) + default_version_gnatprove=$(crudini --get $toolchain_config default_version gnatprove) + default_version_gprbuild=$(crudini --get $toolchain_config default_version gprbuild) + toolchain_versions_gnat=$(crudini --get $toolchain_config toolchains gnat) + toolchain_versions_gnatprove=$(crudini --get $toolchain_config toolchains gnatprove) + toolchain_versions_gprbuild=$(crudini --get $toolchain_config toolchains gprbuild) + + echo path_ada_toolchain_root: $path_ada_toolchain_root + echo path_ada_toolchain_selected: $path_ada_toolchain_selected + echo path_ada_toolchain_default: $path_ada_toolchain_default + echo default_version_gnat: $default_version_gnat + echo default_version_gnatprove: $default_version_gnatprove + echo default_version_gprbuild: $default_version_gprbuild + echo toolchain_versions_gnat: $toolchain_versions_gnat + echo toolchain_versions_gnatprove $toolchain_versions_gnatprove + echo toolchain_versions_gprbuild $toolchain_versions_gprbuild + # Install FSF GNAT - mkdir -p /opt/ada/default - mkdir -p /opt/ada/selected + mkdir -p ${path_ada_toolchain_root} + mkdir -p ${path_ada_toolchain_default} + mkdir -p ${path_ada_toolchain_selected} - gnat_version=("12.2.0-1" "14.1.0-3") - mkdir /opt/ada/gnat + gnat_version=(${toolchain_versions_gnat}) + mkdir ${path_ada_toolchain_root}/gnat for tool_version in ${gnat_version[@]}; do echo Installing GNAT $tool_version wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${tool_version}/gnat-x86_64-linux-${tool_version}.tar.gz && \ tar xzf gnat.tar.gz && \ - mv gnat-* /opt/ada/gnat/${tool_version} && \ + mv gnat-* ${path_ada_toolchain_root}/gnat/${tool_version} && \ rm *.tar.gz done - gnat_prove_version=("12.1.0-1" "14.1.0-1") - mkdir /opt/ada/gnatprove + gnat_prove_version=(${toolchain_versions_gnatprove}) + mkdir ${path_ada_toolchain_root}/gnatprove for tool_version in ${gnat_prove_version[@]}; do echo Installing GNATprove $v wget -O gnatprove.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnatprove-${tool_version}/gnatprove-x86_64-linux-${tool_version}.tar.gz && \ tar xzf gnatprove.tar.gz && \ - mv gnatprove-* /opt/ada/gnatprove/${tool_version} && \ + mv gnatprove-* ${path_ada_toolchain_root}/gnatprove/${tool_version} && \ rm *.tar.gz done - gprbuild_version=("22.0.0-1" "24.0.0-1") - mkdir /opt/ada/gprbuild + gprbuild_version=(${toolchain_versions_gprbuild}) + mkdir ${path_ada_toolchain_root}/gprbuild for tool_version in ${gprbuild_version[@]}; do echo Installing GPRbuild $v wget -O gprbuild.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-${tool_version}/gprbuild-x86_64-linux-${tool_version}.tar.gz && \ tar xzf gprbuild.tar.gz && \ - mv gprbuild-* /opt/ada/gprbuild/${tool_version} && \ + mv gprbuild-* ${path_ada_toolchain_root}/gprbuild/${tool_version} && \ rm *.tar.gz done - ln -sf /opt/ada/gnat/12.2.0-1 /opt/ada/default/gnat - ln -sf /opt/ada/gnatprove/12.1.0-1 /opt/ada/default/gnatprove - ln -sf /opt/ada/gprbuild/22.0.0-1 /opt/ada/default/gprbuild + ln -sf ${path_ada_toolchain_root}/gnat/${default_version_gnat} ${path_ada_toolchain_default}/gnat + ln -sf ${path_ada_toolchain_root}/gnatprove/${default_version_gnatprove} ${path_ada_toolchain_default}/gnatprove + ln -sf ${path_ada_toolchain_root}/gprbuild/${default_version_gprbuild} ${path_ada_toolchain_default}/gprbuild - chown -R vagrant:vagrant /opt/ada + chown -R vagrant:vagrant ${path_ada_toolchain_root} - echo 'export PATH="/opt/ada/selected/gnat/bin:/opt/ada/selected/gprbuild/bin:/opt/ada/selected/gnatprove/bin:/opt/ada/default/gnat/bin:/opt/ada/default/gprbuild/bin:/opt/ada/default/gnatprove/bin:${PATH}"' >> /home/vagrant/.bashrc + echo "export PATH=\\"${path_ada_toolchain_selected}/gnat/bin:${path_ada_toolchain_selected}/gprbuild/bin:${path_ada_toolchain_selected}/gnatprove/bin:${path_ada_toolchain_default}/gnat/bin:${path_ada_toolchain_default}/gprbuild/bin:${path_ada_toolchain_default}/gnatprove/bin:${PATH}\\"" >> /home/vagrant/.bashrc source /home/vagrant/.bashrc # Install learn deps @@ -157,6 +183,7 @@ Vagrant.configure("2") do |config| web.vm.synced_folder './frontend', '/vagrant/frontend' web.vm.synced_folder './content', '/vagrant/content' + web.vm.provision "file", source: "./frontend/py_modules/code_projects/toolchain.ini", destination: "/home/vagrant/toolchain.ini" web.vm.provision :shell, inline: $frontend end @@ -167,6 +194,7 @@ Vagrant.configure("2") do |config| epub.vm.synced_folder './frontend', '/vagrant/frontend' epub.vm.synced_folder './content', '/vagrant/content' + epub.vm.provision "file", source: "./frontend/py_modules/code_projects/toolchain.ini", destination: "/home/vagrant/toolchain.ini" epub.vm.provision :shell, inline: $epub end From 5eb5642a272f66c9fe369c2a51bb4264e582b58f Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 11 Aug 2024 02:53:34 +0200 Subject: [PATCH 3/5] GitHub actions: using toolchain information from configuration file --- .github/workflows/sphinx-books-tests.js.yml | 63 ++++++++++++------- .github/workflows/sphinx-content-tests.js.yml | 32 +++++++--- .github/workflows/sphinx-plugin-tests.js.yml | 62 +++++++++++------- .github/workflows/typescript-tests.js.yml | 62 +++++++++++------- 4 files changed, 146 insertions(+), 73 deletions(-) diff --git a/.github/workflows/sphinx-books-tests.js.yml b/.github/workflows/sphinx-books-tests.js.yml index e7b447f19..1c3b0aaa3 100644 --- a/.github/workflows/sphinx-books-tests.js.yml +++ b/.github/workflows/sphinx-books-tests.js.yml @@ -34,6 +34,7 @@ jobs: run: | sudo apt-get update && \ sudo apt-get install -y \ + crudini \ graphviz \ plantuml \ texlive-latex-base \ @@ -49,45 +50,65 @@ jobs: poppler-utils - name: Install GNAT FSF run: | - sudo mkdir -p /opt/ada/default - sudo mkdir -p /opt/ada/selected - gnat_version=("12.2.0-1" "14.1.0-3") - sudo mkdir /opt/ada/gnat + toolchain_config=${GITHUB_WORKSPACE}/frontend/py_modules/code_projects/toolchain.ini + path_ada_toolchain_root=$(crudini --get $toolchain_config toolchain_path root) + path_ada_toolchain_default=$(crudini --get $toolchain_config toolchain_path default) + path_ada_toolchain_selected=$(crudini --get $toolchain_config toolchain_path selected) + default_version_gnat=$(crudini --get $toolchain_config default_version gnat) + default_version_gnatprove=$(crudini --get $toolchain_config default_version gnatprove) + default_version_gprbuild=$(crudini --get $toolchain_config default_version gprbuild) + toolchain_versions_gnat=$(crudini --get $toolchain_config toolchains gnat) + toolchain_versions_gnatprove=$(crudini --get $toolchain_config toolchains gnatprove) + toolchain_versions_gprbuild=$(crudini --get $toolchain_config toolchains gprbuild) + echo path_ada_toolchain_root: $path_ada_toolchain_root + echo path_ada_toolchain_default: $path_ada_toolchain_default + echo path_ada_toolchain_selected: $path_ada_toolchain_selected + echo default_version_gnat: $default_version_gnat + echo default_version_gnatprove: $default_version_gnatprove + echo default_version_gprbuild: $default_version_gprbuild + echo toolchain_versions_gnat: $toolchain_versions_gnat + echo toolchain_versions_gnatprove $toolchain_versions_gnatprove + echo toolchain_versions_gprbuild $toolchain_versions_gprbuild + sudo mkdir -p ${path_ada_toolchain_root} + sudo mkdir -p ${path_ada_toolchain_default} + sudo mkdir -p ${path_ada_toolchain_selected} + gnat_version=(${toolchain_versions_gnat}) + sudo mkdir ${path_ada_toolchain_root}/gnat for tool_version in ${gnat_version[@]}; do echo Installing GNAT $tool_version sudo wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${tool_version}/gnat-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnat.tar.gz && \ - sudo mv gnat-* /opt/ada/gnat/${tool_version} && \ + sudo mv gnat-* ${path_ada_toolchain_root}/gnat/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnat/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnat/bin" >> $GITHUB_PATH - gnat_prove_version=("12.1.0-1" "14.1.0-1") - sudo mkdir /opt/ada/gnatprove + sudo echo "${path_ada_toolchain_default}/gnat/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnat/bin" >> $GITHUB_PATH + gnat_prove_version=(${toolchain_versions_gnatprove}) + sudo mkdir ${path_ada_toolchain_root}/gnatprove for tool_version in ${gnat_prove_version[@]}; do echo Installing GNATprove $v sudo wget -O gnatprove.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnatprove-${tool_version}/gnatprove-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnatprove.tar.gz && \ - sudo mv gnatprove-* /opt/ada/gnatprove/${tool_version} && \ + sudo mv gnatprove-* ${path_ada_toolchain_root}/gnatprove/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnatprove/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnatprove/bin" >> $GITHUB_PATH - gprbuild_version=("22.0.0-1" "24.0.0-1") - sudo mkdir /opt/ada/gprbuild + sudo echo "${path_ada_toolchain_default}/gnatprove/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnatprove/bin" >> $GITHUB_PATH + gprbuild_version=(${toolchain_versions_gprbuild}) + sudo mkdir ${path_ada_toolchain_root}/gprbuild for tool_version in ${gprbuild_version[@]}; do echo Installing GPRbuild $v sudo wget -O gprbuild.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-${tool_version}/gprbuild-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gprbuild.tar.gz && \ - sudo mv gprbuild-* /opt/ada/gprbuild/${tool_version} && \ + sudo mv gprbuild-* ${path_ada_toolchain_root}/gprbuild/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gprbuild/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gprbuild/bin" >> $GITHUB_PATH - sudo ln -sf /opt/ada/gnat/12.2.0-1 /opt/ada/default/gnat - sudo ln -sf /opt/ada/gnatprove/12.1.0-1 /opt/ada/default/gnatprove - sudo ln -sf /opt/ada/gprbuild/22.0.0-1 /opt/ada/default/gprbuild - sudo chmod -R ugo+w /opt/ada/selected + sudo echo "${path_ada_toolchain_default}/gprbuild/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gprbuild/bin" >> $GITHUB_PATH + sudo ln -sf ${path_ada_toolchain_root}/gnat/${default_version_gnat} ${path_ada_toolchain_default}/gnat + sudo ln -sf ${path_ada_toolchain_root}/gnatprove/${default_version_gnatprove} ${path_ada_toolchain_default}/gnatprove + sudo ln -sf ${path_ada_toolchain_root}/gprbuild/${default_version_gprbuild} ${path_ada_toolchain_default}/gprbuild + sudo chmod -R ugo+w ${path_ada_toolchain_selected} - name: Increase max user watches run: | echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && \ diff --git a/.github/workflows/sphinx-content-tests.js.yml b/.github/workflows/sphinx-content-tests.js.yml index b317f2832..83efbefea 100644 --- a/.github/workflows/sphinx-content-tests.js.yml +++ b/.github/workflows/sphinx-content-tests.js.yml @@ -37,22 +37,34 @@ jobs: graphviz \ plantuml - name: Install GNAT FSF - run: | - sudo mkdir -p /opt/ada/default - sudo mkdir -p /opt/ada/selected - gnat_version=("12.2.0-1" "14.1.0-3") - sudo mkdir /opt/ada/gnat + run: | + toolchain_config=${GITHUB_WORKSPACE}/frontend/py_modules/code_projects/toolchain.ini + path_ada_toolchain_root=$(crudini --get $toolchain_config toolchain_path root) + path_ada_toolchain_default=$(crudini --get $toolchain_config toolchain_path default) + path_ada_toolchain_selected=$(crudini --get $toolchain_config toolchain_path selected) + default_version_gnat=$(crudini --get $toolchain_config default_version gnat) + toolchain_versions_gnat=$(crudini --get $toolchain_config toolchains gnat) + echo path_ada_toolchain_root: $path_ada_toolchain_root + echo path_ada_toolchain_default: $path_ada_toolchain_default + echo path_ada_toolchain_selected: $path_ada_toolchain_selected + echo default_version_gnat: $default_version_gnat + echo toolchain_versions_gnat: $toolchain_versions_gnat + sudo mkdir -p ${path_ada_toolchain_root} + sudo mkdir -p ${path_ada_toolchain_default} + sudo mkdir -p ${path_ada_toolchain_selected} + gnat_version=(${toolchain_versions_gnat}) + sudo mkdir ${path_ada_toolchain_root}/gnat for tool_version in ${gnat_version[@]}; do echo Installing GNAT $tool_version sudo wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${tool_version}/gnat-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnat.tar.gz && \ - sudo mv gnat-* /opt/ada/gnat/${tool_version} && \ + sudo mv gnat-* ${path_ada_toolchain_root}/gnat/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnat/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnat/bin" >> $GITHUB_PATH - sudo ln -sf /opt/ada/gnat/12.2.0-1 /opt/ada/default/gnat - sudo chmod -R ugo+w /opt/ada/selected + sudo echo "${path_ada_toolchain_default}/gnat/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnat/bin" >> $GITHUB_PATH + sudo ln -sf ${path_ada_toolchain_root}/gnat/${default_version_gnat} ${path_ada_toolchain_default}/gnat + sudo chmod -R ugo+w ${path_ada_toolchain_selected} - name: Increase max user watches run: | echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && \ diff --git a/.github/workflows/sphinx-plugin-tests.js.yml b/.github/workflows/sphinx-plugin-tests.js.yml index 2572d990a..08f7190ab 100644 --- a/.github/workflows/sphinx-plugin-tests.js.yml +++ b/.github/workflows/sphinx-plugin-tests.js.yml @@ -30,45 +30,65 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install GNAT FSF run: | - sudo mkdir -p /opt/ada/default - sudo mkdir -p /opt/ada/selected - gnat_version=("12.2.0-1" "14.1.0-3") - sudo mkdir /opt/ada/gnat + toolchain_config=${GITHUB_WORKSPACE}/frontend/py_modules/code_projects/toolchain.ini + path_ada_toolchain_root=$(crudini --get $toolchain_config toolchain_path root) + path_ada_toolchain_default=$(crudini --get $toolchain_config toolchain_path default) + path_ada_toolchain_selected=$(crudini --get $toolchain_config toolchain_path selected) + default_version_gnat=$(crudini --get $toolchain_config default_version gnat) + default_version_gnatprove=$(crudini --get $toolchain_config default_version gnatprove) + default_version_gprbuild=$(crudini --get $toolchain_config default_version gprbuild) + toolchain_versions_gnat=$(crudini --get $toolchain_config toolchains gnat) + toolchain_versions_gnatprove=$(crudini --get $toolchain_config toolchains gnatprove) + toolchain_versions_gprbuild=$(crudini --get $toolchain_config toolchains gprbuild) + echo path_ada_toolchain_root: $path_ada_toolchain_root + echo path_ada_toolchain_default: $path_ada_toolchain_default + echo path_ada_toolchain_selected: $path_ada_toolchain_selected + echo default_version_gnat: $default_version_gnat + echo default_version_gnatprove: $default_version_gnatprove + echo default_version_gprbuild: $default_version_gprbuild + echo toolchain_versions_gnat: $toolchain_versions_gnat + echo toolchain_versions_gnatprove $toolchain_versions_gnatprove + echo toolchain_versions_gprbuild $toolchain_versions_gprbuild + sudo mkdir -p ${path_ada_toolchain_root} + sudo mkdir -p ${path_ada_toolchain_default} + sudo mkdir -p ${path_ada_toolchain_selected} + gnat_version=(${toolchain_versions_gnat}) + sudo mkdir ${path_ada_toolchain_root}/gnat for tool_version in ${gnat_version[@]}; do echo Installing GNAT $tool_version sudo wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${tool_version}/gnat-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnat.tar.gz && \ - sudo mv gnat-* /opt/ada/gnat/${tool_version} && \ + sudo mv gnat-* ${path_ada_toolchain_root}/gnat/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnat/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnat/bin" >> $GITHUB_PATH - gnat_prove_version=("12.1.0-1" "14.1.0-1") - sudo mkdir /opt/ada/gnatprove + sudo echo "${path_ada_toolchain_default}/gnat/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnat/bin" >> $GITHUB_PATH + gnat_prove_version=(${toolchain_versions_gnatprove}) + sudo mkdir ${path_ada_toolchain_root}/gnatprove for tool_version in ${gnat_prove_version[@]}; do echo Installing GNATprove $v sudo wget -O gnatprove.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnatprove-${tool_version}/gnatprove-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnatprove.tar.gz && \ - sudo mv gnatprove-* /opt/ada/gnatprove/${tool_version} && \ + sudo mv gnatprove-* ${path_ada_toolchain_root}/gnatprove/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnatprove/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnatprove/bin" >> $GITHUB_PATH - gprbuild_version=("22.0.0-1" "24.0.0-1") - sudo mkdir /opt/ada/gprbuild + sudo echo "${path_ada_toolchain_default}/gnatprove/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnatprove/bin" >> $GITHUB_PATH + gprbuild_version=(${toolchain_versions_gprbuild}) + sudo mkdir ${path_ada_toolchain_root}/gprbuild for tool_version in ${gprbuild_version[@]}; do echo Installing GPRbuild $v sudo wget -O gprbuild.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-${tool_version}/gprbuild-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gprbuild.tar.gz && \ - sudo mv gprbuild-* /opt/ada/gprbuild/${tool_version} && \ + sudo mv gprbuild-* ${path_ada_toolchain_root}/gprbuild/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gprbuild/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gprbuild/bin" >> $GITHUB_PATH - sudo ln -sf /opt/ada/gnat/12.2.0-1 /opt/ada/default/gnat - sudo ln -sf /opt/ada/gnatprove/12.1.0-1 /opt/ada/default/gnatprove - sudo ln -sf /opt/ada/gprbuild/22.0.0-1 /opt/ada/default/gnatprove - sudo chmod -R ugo+w /opt/ada/selected + sudo echo "${path_ada_toolchain_default}/gprbuild/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gprbuild/bin" >> $GITHUB_PATH + sudo ln -sf ${path_ada_toolchain_root}/gnat/${default_version_gnat} ${path_ada_toolchain_default}/gnat + sudo ln -sf ${path_ada_toolchain_root}/gnatprove/${default_version_gnatprove} ${path_ada_toolchain_default}/gnatprove + sudo ln -sf ${path_ada_toolchain_root}/gprbuild/${default_version_gprbuild} ${path_ada_toolchain_default}/gprbuild + sudo chmod -R ugo+w ${path_ada_toolchain_selected} - name: Increase max user watches run: | echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && \ diff --git a/.github/workflows/typescript-tests.js.yml b/.github/workflows/typescript-tests.js.yml index 8ed4f858d..f608dfa2f 100644 --- a/.github/workflows/typescript-tests.js.yml +++ b/.github/workflows/typescript-tests.js.yml @@ -39,45 +39,65 @@ jobs: cache: 'yarn' - name: Install GNAT FSF run: | - sudo mkdir -p /opt/ada/default - sudo mkdir -p /opt/ada/selected - gnat_version=("12.2.0-1" "14.1.0-3") - sudo mkdir /opt/ada/gnat + toolchain_config=${GITHUB_WORKSPACE}/frontend/py_modules/code_projects/toolchain.ini + path_ada_toolchain_root=$(crudini --get $toolchain_config toolchain_path root) + path_ada_toolchain_default=$(crudini --get $toolchain_config toolchain_path default) + path_ada_toolchain_selected=$(crudini --get $toolchain_config toolchain_path selected) + default_version_gnat=$(crudini --get $toolchain_config default_version gnat) + default_version_gnatprove=$(crudini --get $toolchain_config default_version gnatprove) + default_version_gprbuild=$(crudini --get $toolchain_config default_version gprbuild) + toolchain_versions_gnat=$(crudini --get $toolchain_config toolchains gnat) + toolchain_versions_gnatprove=$(crudini --get $toolchain_config toolchains gnatprove) + toolchain_versions_gprbuild=$(crudini --get $toolchain_config toolchains gprbuild) + echo path_ada_toolchain_root: $path_ada_toolchain_root + echo path_ada_toolchain_default: $path_ada_toolchain_default + echo path_ada_toolchain_selected: $path_ada_toolchain_selected + echo default_version_gnat: $default_version_gnat + echo default_version_gnatprove: $default_version_gnatprove + echo default_version_gprbuild: $default_version_gprbuild + echo toolchain_versions_gnat: $toolchain_versions_gnat + echo toolchain_versions_gnatprove $toolchain_versions_gnatprove + echo toolchain_versions_gprbuild $toolchain_versions_gprbuild + sudo mkdir -p ${path_ada_toolchain_root} + sudo mkdir -p ${path_ada_toolchain_default} + sudo mkdir -p ${path_ada_toolchain_selected} + gnat_version=(${toolchain_versions_gnat}) + sudo mkdir ${path_ada_toolchain_root}/gnat for tool_version in ${gnat_version[@]}; do echo Installing GNAT $tool_version sudo wget -O gnat.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-${tool_version}/gnat-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnat.tar.gz && \ - sudo mv gnat-* /opt/ada/gnat/${tool_version} && \ + sudo mv gnat-* ${path_ada_toolchain_root}/gnat/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnat/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnat/bin" >> $GITHUB_PATH - gnat_prove_version=("12.1.0-1" "14.1.0-1") - sudo mkdir /opt/ada/gnatprove + sudo echo "${path_ada_toolchain_default}/gnat/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnat/bin" >> $GITHUB_PATH + gnat_prove_version=(${toolchain_versions_gnatprove}) + sudo mkdir ${path_ada_toolchain_root}/gnatprove for tool_version in ${gnat_prove_version[@]}; do echo Installing GNATprove $v sudo wget -O gnatprove.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnatprove-${tool_version}/gnatprove-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gnatprove.tar.gz && \ - sudo mv gnatprove-* /opt/ada/gnatprove/${tool_version} && \ + sudo mv gnatprove-* ${path_ada_toolchain_root}/gnatprove/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gnatprove/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gnatprove/bin" >> $GITHUB_PATH - gprbuild_version=("22.0.0-1" "24.0.0-1") - sudo mkdir /opt/ada/gprbuild + sudo echo "${path_ada_toolchain_default}/gnatprove/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gnatprove/bin" >> $GITHUB_PATH + gprbuild_version=(${toolchain_versions_gprbuild}) + sudo mkdir ${path_ada_toolchain_root}/gprbuild for tool_version in ${gprbuild_version[@]}; do echo Installing GPRbuild $v sudo wget -O gprbuild.tar.gz https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-${tool_version}/gprbuild-x86_64-linux-${tool_version}.tar.gz && \ sudo tar xzf gprbuild.tar.gz && \ - sudo mv gprbuild-* /opt/ada/gprbuild/${tool_version} && \ + sudo mv gprbuild-* ${path_ada_toolchain_root}/gprbuild/${tool_version} && \ sudo rm *.tar.gz done - sudo echo "/opt/ada/default/gprbuild/bin" >> $GITHUB_PATH - sudo echo "/opt/ada/selected/gprbuild/bin" >> $GITHUB_PATH - sudo ln -sf /opt/ada/gnat/12.2.0-1 /opt/ada/default/gnat - sudo ln -sf /opt/ada/gnatprove/12.1.0-1 /opt/ada/default/gnatprove - sudo ln -sf /opt/ada/gprbuild/22.0.0-1 /opt/ada/default/gnatprove - sudo chmod -R ugo+w /opt/ada/selected + sudo echo "${path_ada_toolchain_default}/gprbuild/bin" >> $GITHUB_PATH + sudo echo "${path_ada_toolchain_selected}/gprbuild/bin" >> $GITHUB_PATH + sudo ln -sf ${path_ada_toolchain_root}/gnat/${default_version_gnat} ${path_ada_toolchain_default}/gnat + sudo ln -sf ${path_ada_toolchain_root}/gnatprove/${default_version_gnatprove} ${path_ada_toolchain_default}/gnatprove + sudo ln -sf ${path_ada_toolchain_root}/gprbuild/${default_version_gprbuild} ${path_ada_toolchain_default}/gprbuild + sudo chmod -R ugo+w ${path_ada_toolchain_selected} - name: Increase max user watches run: | echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && \ From f8a3fed3082f4bd0f646bba820e1962c621e67e4 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 11 Aug 2024 02:54:56 +0200 Subject: [PATCH 4/5] Test script: adding module for toolchain information Adding module to load toolchain information from config file. --- .../code_projects/toolchain_info.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 frontend/py_modules/code_projects/toolchain_info.py diff --git a/frontend/py_modules/code_projects/toolchain_info.py b/frontend/py_modules/code_projects/toolchain_info.py new file mode 100644 index 000000000..45a59f05b --- /dev/null +++ b/frontend/py_modules/code_projects/toolchain_info.py @@ -0,0 +1,39 @@ +#! /usr/bin/env python3 + +import os +import re +import configparser + +TOOLCHAIN_CONFIG = os.path.dirname(os.path.realpath(__file__)) + "/" + "toolchain.ini" + +TOOLCHAIN_PATH = {} +TOOLCHAINS = {} +DEFAULT_VERSION = {} + +def init_toolchain_info(): + config = configparser.ConfigParser() + + config.read(TOOLCHAIN_CONFIG) + + DEFAULT_VERSION['gnat'] = config['default_version']['gnat'] + DEFAULT_VERSION['gnatprove'] = config['default_version']['gnatprove'] + DEFAULT_VERSION['gprbuild'] = config['default_version']['gprbuild'] + + TOOLCHAIN_PATH['root'] = config['toolchain_path']['root'] + TOOLCHAIN_PATH['selected'] = config['toolchain_path']['selected'] + TOOLCHAIN_PATH['default'] = config['toolchain_path']['default'] + + TOOLCHAINS['gnat'] = str(config['toolchains']['gnat']) + TOOLCHAINS['gnatprove'] = str(config['toolchains']['gnatprove']) + TOOLCHAINS['gprbuild'] = str(config['toolchains']['gprbuild']) + + TOOLCHAINS['gnat'] = re.split(r'\s+',TOOLCHAINS['gnat']) + TOOLCHAINS['gnatprove'] = re.split(r'\s+',TOOLCHAINS['gnatprove']) + TOOLCHAINS['gprbuild'] = re.split(r'\s+',TOOLCHAINS['gprbuild']) + +def get_toolchain_default_version(tool): + # Force initialization if info isn't available + if not tool in DEFAULT_VERSION: + init_toolchain_info() + + return DEFAULT_VERSION[tool] From b70ab11f3b5a6c2f349df708c229f7558e4f8fb2 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sun, 11 Aug 2024 02:56:31 +0200 Subject: [PATCH 5/5] Test script: using new toolchain_info module --- .../code_projects/toolchain_setup.py | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/frontend/py_modules/code_projects/toolchain_setup.py b/frontend/py_modules/code_projects/toolchain_setup.py index 0a90db626..d3e959cdc 100644 --- a/frontend/py_modules/code_projects/toolchain_setup.py +++ b/frontend/py_modules/code_projects/toolchain_setup.py @@ -1,25 +1,22 @@ #! /usr/bin/env python3 import os +import re import blocks - -DEFAULT_VERSION = {} -DEFAULT_VERSION['gnat'] = "12.2.0-1" -DEFAULT_VERSION['gnatprove'] = "12.1.0-1" -DEFAULT_VERSION['gprbuild'] = "22.0.0-1" -TOOLCHAIN_PATH = "/opt/ada" - -def get_toolchain_default_version(tool): - return DEFAULT_VERSION[tool] +import toolchain_info as info def set_toolchain(block : blocks.CodeBlock): + # Init toolchain info if not initialized + if not 'root' in info.TOOLCHAIN_PATH: + info.init_toolchain_info() + # Reset toolchain to ensure that no toolchain exists in the "select" folder reset_toolchain() # Create "selected" folder if it doesn't exist - selected_path = TOOLCHAIN_PATH + '/selected' + selected_path = info.TOOLCHAIN_PATH['selected'] os.makedirs(selected_path, mode=0o777, exist_ok=True) @@ -27,27 +24,26 @@ def set_toolchain(block : blocks.CodeBlock): if block.gnat_version != "default": ver = block.gnat_version - os.symlink(TOOLCHAIN_PATH + '/gnat/' + ver, - TOOLCHAIN_PATH + '/selected/gnat') + os.symlink(info.TOOLCHAIN_PATH['root'] + '/gnat/' + ver, + info.TOOLCHAIN_PATH['selected'] + '/gnat') if block.gnatprove_version != "default": ver = block.gnatprove_version - os.symlink(TOOLCHAIN_PATH + '/gnatprove/' + ver, - TOOLCHAIN_PATH + '/selected/gnatprove') + os.symlink(info.TOOLCHAIN_PATH['root'] + '/gnatprove/' + ver, + info.TOOLCHAIN_PATH['selected'] + '/gnatprove') if block.gprbuild_version != "default": ver = block.gprbuild_version - os.symlink(TOOLCHAIN_PATH + '/gprbuild/' + ver, - TOOLCHAIN_PATH + '/selected/gprbuild') - + os.symlink(info.TOOLCHAIN_PATH['root'] + '/gprbuild/' + ver, + info.TOOLCHAIN_PATH['selected'] + '/gprbuild') def reset_toolchain(): - selected_folders = [TOOLCHAIN_PATH + '/selected/gnat', - TOOLCHAIN_PATH + '/selected/gnatprove', - TOOLCHAIN_PATH + '/selected/gprbuild'] + selected_folders = [info.TOOLCHAIN_PATH['selected'] + '/gnat', + info.TOOLCHAIN_PATH['selected'] + '/gnatprove', + info.TOOLCHAIN_PATH['selected'] + '/gprbuild'] for f in selected_folders: if os.path.exists(f):