Skip to content

Commit

Permalink
Judgehost: Use ICPC mirror for kotlinc
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsijm committed Apr 28, 2022
1 parent aa9adf4 commit 33f508d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
*.env
cds/
db_data
kotlin-compiler.zip
kotlinc/
2 changes: 0 additions & 2 deletions judgehost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ ENV LANG_CSHARP=yes
ENV LANG_PYPY3=yes
ENV CHROOT=/chroot/domjudge
COPY install_languages.sh /
ARG KOTLIN_VERSION=1.5.31
COPY --chown=domjudge:domjudge kotlinc /usr/local/lib/kotlinc
8 changes: 0 additions & 8 deletions judgehost/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -e

DEFAULT_VERSION=8.0.0
KOTLIN_VERSION=1.5.31
VERSION=$1
if [ -z ${VERSION} ]
then
Expand All @@ -13,13 +12,6 @@ then
VERSION=${DEFAULT_VERSION}
fi

if [ ! -d kotlinc ]; then
# cheat so there is no need to install curl and unzip the image and faster when fine tuning
echo "Downloading kotlin distribution"
curl -o kotlin-compiler.zip -L https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip
unzip kotlin-compiler.zip
fi

# To add packages in chroot we need to run in privileged mode and this can't be done in a docker file.
docker build -t domjudge/judgehost-extended:${VERSION}-build -f Dockerfile --build-arg VERSION=${VERSION} .
docker rm -f domjudge-judgehost-extended-${VERSION}-build 2>&1 || true
Expand Down
31 changes: 16 additions & 15 deletions judgehost/install_languages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ install_pypy3() {


install_kotlin() {
# Package is downloaded and unzipped by docker file, just create links for path
# Directory matters, e.g. installing in /opt fails
ln -s /usr/local/lib/kotlinc/bin/kotlinc /usr/bin/kotlinc
ln -s /usr/local/lib/kotlinc/bin/kotlin /usr/bin/kotlin
# copy full kotlin distribution
cp -r usr/local/lib/kotlinc ${CHROOT}/usr/local/lib/
# remove kotlinx jars since they are not allowed during contest
rm ${CHROOT}/usr/local/lib/kotlinc/lib/kotlinx*.jar
# remove unessecary jars
rm ${CHROOT}/usr/local/lib/kotlinc/lib/kotlin-test*.jar
rm ${CHROOT}/usr/local/lib/kotlinc/lib/kotlin-annotation*.jar
rm ${CHROOT}/usr/local/lib/kotlinc/lib/android*.jar
rm ${CHROOT}/usr/local/lib/kotlinc/lib/*compiler*.jar
rm ${CHROOT}/usr/local/lib/kotlinc/lib/js*.jar
/opt/domjudge/judgehost/bin/dj_run_chroot "ln -s /usr/local/lib/kotlinc/bin/kotlin /usr/bin/kotlin && ln -s /usr/local/lib/kotlinc/bin/kotlinc /usr/bin/kotlinc"
echo "deb [trusted=yes] https://pc2.ecs.baylor.edu/apt focal main" >> /etc/apt/sources.list
echo 'Acquire::https::pc2.ecs.baylor.edu::Verify-Peer "false";
Acquire::https::pc2.ecs.baylor.edu::Verify-Host "false";' >> /etc/apt/apt.conf.d/80trust-baylor-mirror

echo "deb [trusted=yes] https://pc2.ecs.baylor.edu/apt focal main" >> ${CHROOT}/etc/apt/sources.list
echo 'Acquire::https::pc2.ecs.baylor.edu::Verify-Peer "false";
Acquire::https::pc2.ecs.baylor.edu::Verify-Host "false";' >> ${CHROOT}/etc/apt/apt.conf.d/80trust-baylor-mirror

ln -s /usr/lib/kotlinc/bin/kotlinc /usr/bin/kotlinc
ln -s /usr/lib/kotlinc/bin/kotlin /usr/bin/kotlin

ln -s ${CHROOT}/usr/lib/kotlinc/bin/kotlinc ${CHROOT}/usr/bin/kotlinc
ln -s ${CHROOT}/usr/lib/kotlinc/bin/kotlin ${CHROOT}/usr/bin/kotlin

DEB_PACKAGES="icpc-kotlinc $DEB_PACKAGES"
CHROOT_PACKAGES="icpc-kotlinc $CHROOT_PACKAGES"
}

install_csharp() {
Expand Down

0 comments on commit 33f508d

Please sign in to comment.