From 1f68306ef996697f0b8044b0a13f48e018ae892b Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sun, 3 Sep 2023 11:06:48 +0200 Subject: [PATCH 1/2] Construct ZIP files while uploading executables. This is an improvement on top of #2129, since you do not need to check in ZIP files into a ccsconfig repository, but directories which are zipped up on the fly. This makes changing and reviewing changes much easier. --- misc-tools/configure-domjudge.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/misc-tools/configure-domjudge.in b/misc-tools/configure-domjudge.in index 360f783d5e..7de6a6901d 100755 --- a/misc-tools/configure-domjudge.in +++ b/misc-tools/configure-domjudge.in @@ -17,6 +17,7 @@ import json import os.path import requests import requests.utils +import shutil import sys from typing import List, Set @@ -101,11 +102,15 @@ else: if os.path.exists('executables'): executables = [] for file in os.listdir('executables'): - if file.endswith(".zip"): - executables.append(file[:-4]) - if executables and dj_utils.confirm('Upload language executables (found: ' + ','.join(executables) + ')?', False): + if os.path.isdir(f'executables/{file}'): + executables.append(file) + + if executables: + if dj_utils.confirm('Upload language executables (found: ' + ','.join(executables) + ')?', False): + for langid in executables: + dj_utils.upload_file(f'languages/{langid}/executable', 'executable', f'executables/{langid}.zip') for langid in executables: - dj_utils.upload_file(f'languages/{langid}/executable', 'executable', f'executables/{langid}.zip') + os.remove(f'executables/{langid}.zip') if os.path.exists('languages.json'): From f66300c2b8934e343602dfa69c802f7f6ed71772 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sun, 3 Sep 2023 11:20:06 +0200 Subject: [PATCH 2/2] fix missing shutil.make_archive command --- misc-tools/configure-domjudge.in | 1 + 1 file changed, 1 insertion(+) diff --git a/misc-tools/configure-domjudge.in b/misc-tools/configure-domjudge.in index 7de6a6901d..6fc6dabf54 100755 --- a/misc-tools/configure-domjudge.in +++ b/misc-tools/configure-domjudge.in @@ -104,6 +104,7 @@ if os.path.exists('executables'): for file in os.listdir('executables'): if os.path.isdir(f'executables/{file}'): executables.append(file) + shutil.make_archive(f'executables/{file}', 'zip', f'executables/{file}') if executables: if dj_utils.confirm('Upload language executables (found: ' + ','.join(executables) + ')?', False):