Files
2026-10-15 20:44:05 -03:00

127 lines
4.6 KiB
YAML

- name: Compilers of the contest (same versions and options as Kattis)
hosts: all
become: yes
vars:
# From atlantic-canada26.kattis.com/contests/atlantic-canada26/languages
# C gcc-15 15.2.0
# C++ g++-15 15.2.0
# Java javac / java 25.0.4.1
# Python 3 pypy3 7.3.23 (Python 3.11.15)
# All these versions are present in the base ICPC image. The download
# block also corrects an existing build with a different Java version.
# Checksums are from the ICPC Ubuntu repository's package metadata.
jdk_version: "25.0.4.1+1-1~26.04.4"
jdk_packages:
- { name: openjdk-25-jre-headless, arch: amd64, sha256: fc2084482511d56ccb4c33746fe693313a5c0fdcc9a0442e8227e6ba948006d1 }
- { name: openjdk-25-jre, arch: amd64, sha256: 743a58cd138ccc58c1fbdfd26938a0c75edf21cebe1b938f09f37f4a2fb94866 }
- { name: openjdk-25-jdk-headless, arch: amd64, sha256: 7561b5bccd2644d8a2da5dcdfb597a40234f481e098bf785d1a8c8f90202e655 }
- { name: openjdk-25-jdk, arch: amd64, sha256: 9259712883b6ee039b86b7b08292cfb7747bd030e4ee73c66c2517f95999a861 }
- { name: openjdk-25-source, arch: all, sha256: d4949263fd30053bcb96b247bc6971b8b3d2a7d8e0cfec4c106095f52c3948a9 }
jdk_cache: /var/cache/acpc-jdk
tasks:
- name: Make sure GCC 15 is installed
apt:
name: [gcc-15, g++-15]
state: present
- name: Check the installed Java packages
command:
argv:
- dpkg-query
- -W
- '-f=${Version} ${db:Status-Status}'
- '{{ item.name }}'
loop: '{{ jdk_packages }}'
register: jdk_installed
changed_when: false
failed_when: false
- name: Install the contest Java version if it differs
when: (jdk_installed.results | map(attribute='stdout') | unique | list) != [jdk_version ~ ' installed']
block:
- name: Create the download directory
file:
path: "{{ jdk_cache }}"
state: directory
mode: '0755'
- name: Download the Java 25.0.4.1 packages
get_url:
url: "https://sysopspackages.icpc.global/ubuntu/resolute/pool/main/o/openjdk-25/{{ item.name }}_{{ jdk_version }}_{{ item.arch }}.deb"
dest: "{{ jdk_cache }}/{{ item.name }}_{{ jdk_version }}_{{ item.arch }}.deb"
checksum: "sha256:{{ item.sha256 }}"
mode: '0644'
loop: "{{ jdk_packages }}"
# Their exact-version dependencies must be updated together.
- name: Install the checked Java packages together
command: >-
dpkg --force-confdef --force-confold --install
{% for package in jdk_packages %}
{{ jdk_cache }}/{{ package.name }}_{{ jdk_version }}_{{ package.arch }}.deb
{% endfor %}
- name: Remove the downloaded packages
file:
path: "{{ jdk_cache }}"
state: absent
- name: Keep Java at 25.0.4.1 (no automatic upgrade)
dpkg_selections:
name: "{{ item.name }}"
selection: hold
loop: "{{ jdk_packages }}"
- name: Install the compile and run commands
copy:
src: "files/languages/{{ item }}"
dest: "/usr/local/bin/{{ item }}"
mode: '0755'
loop:
- compilec
- compilecpp
- compilejava
- compilepython3
- runc
- runcpp
- runjava
- runpython3
# Names used by the ICPC technical notes
- name: Keep compilegcc and compileg++ as other names
file:
src: "/usr/local/bin/{{ item.src }}"
dest: "/usr/local/bin/{{ item.dest }}"
state: link
force: yes
loop:
- { src: compilec, dest: compilegcc }
- { src: compilecpp, dest: compileg++ }
- name: Read the versions
shell: |
gcc-15 -dumpfullversion
g++-15 -dumpfullversion
java -version 2>&1 | head -1
javac -version 2>&1
pypy3 -c 'import sys; print(sys.pypy_version_info[:3], sys.version_info[:3])'
register: versions
changed_when: false
- name: Check the versions against Kattis
assert:
that:
- versions.stdout_lines[0] == "15.2.0"
- versions.stdout_lines[1] == "15.2.0"
- "'\"25.0.4.1\"' in versions.stdout_lines[2]"
- versions.stdout_lines[3] == "javac 25.0.4.1"
- versions.stdout_lines[4] == "(7, 3, 23) (3, 11, 15)"
fail_msg: "{{ versions.stdout_lines }}"
- name: Install the technical notes for the teams
copy:
src: docs/TechNotes.pdf
dest: /usr/share/doc/icpc/TechNotes.pdf
mode: '0644'