Skip to content

Commit

Permalink
Simplify further
Browse files Browse the repository at this point in the history
  • Loading branch information
thijskh committed Nov 24, 2023
1 parent 4395bbd commit 9124a46
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 30 deletions.
1 change: 0 additions & 1 deletion doc/manual/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/version.py
/substitutions.py
/html
/team
/conf_ref.rst
6 changes: 6 additions & 0 deletions doc/team/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_minted-team-manual/
team-manual.aux
team-manual.log
team-manual.out
team-manual.pdf
gentexconfig
8 changes: 4 additions & 4 deletions doc/team/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif

install-docs:
$(INSTALL_PROG) -t $(DESTDIR)$(domjudge_docdir)/team \
gentexconfig genteammanuals
gentexconfig genteammanual
$(INSTALL_DATA) -t $(DESTDIR)$(domjudge_docdir)/team \
team-manual.tex team-manual.pdf
$(INSTALL_DATA) -T README $(DESTDIR)$(domjudge_docdir)/README.teammanual
Expand All @@ -25,16 +25,16 @@ gentexconfig: gentexconfig.in $(TOPDIR)/paths.mk
$(substconfigvars)

# 'genteammanual' (re-)generates all versions even if only one is not up-to-date.
$(MANUALSPDF): %pdf: %tex team-manual-preamble.tex $(TOPDIR)/etc/domserver-config.php
./genteammanuals
$(MANUALSPDF): %pdf: %tex team-manual-preamble.tex
./genteammanual

# Cleanup LaTeX logs, etc. after generating documentation for distribution.
distdocs-l:
$(MAKE) clean

clean-l:
-rm -f $(addprefix team-manual.,aux log out)
-rm -rf _minted-team-manual*
-rm -rf _minted-team-manual

distclean-l:
-rm -f gentexconfig
Expand Down
14 changes: 5 additions & 9 deletions doc/team/genteammanuals → doc/team/genteammanual
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

set -e

SOURCES="team-manual.tex team-manual-??.tex"
SOURCE=team-manual.tex
PREAMBLE=team-manual-preamble.tex

NRUNS=3
Expand Down Expand Up @@ -42,24 +42,20 @@ fi
# Run LaTeX:
# shellcheck disable=SC2059
{
for f in $SOURCES ; do
# Skip non-existing files due to unexpanded globbing:
[ -f "$f" ] || continue
[ "$QUIET" ] || printf "Running $NRUNS passes of '%s'..." "$LATEX $LATEXFLAGS $f"
[ "$QUIET" ] || printf "Running $NRUNS passes of '%s'..." "$LATEX $LATEXFLAGS $SOURCE"
run=1
while [ "$run" -le "$NRUNS" ]; do
# shellcheck disable=SC2086
if ! ( cat "$TEXCONFIG" ; echo \\"input{$f}" ) | \
$LATEX $LATEXFLAGS -jobname "${f%.tex}" -output-directory "$OUTPUTDIR" >/dev/null ; then
printf "\\nTeX-ing failed in run $run, see '%s' for details.\\n" "${f%tex}log$"
if ! ( cat "$TEXCONFIG" ; echo \\"input{$SOURCE}" ) | \
$LATEX $LATEXFLAGS -jobname "${SOURCE%.tex}" -output-directory "$OUTPUTDIR" >/dev/null ; then
printf "\\nTeX-ing failed in run $run, see '%s' for details.\\n" "${SOURCE%tex}log"
exit 1
else
[ "$QUIET" ] || printf " $run"
fi
run=$((run+1))
done
[ "$QUIET" ] || printf "\\n" ;
done
} # end shellcheck disable

rm -f "$TEXCONFIG"
19 changes: 3 additions & 16 deletions doc/team/gentexconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,20 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
$config = '@domserver_etcdir@/domserver-static.php';

// This script might be run before or after autoconf variable
// substitution, so we try to read the config from all possible
// places:
// substitution.
if (is_readable($config)) {
require($config);
require(ETCDIR . '/domserver-config.php');
@include(ETCDIR . '/judgehost-config.php');
} else {
@include('../../etc/domserver-config.php');
@include('../../etc/judgehost-config.php');
define(
'DOMJUDGE_VERSION',
`grep -E 'DOMjudge.* version' ../../README.md | sed -n '1s/.*version //p' | tr -d '\n'`
);
}

// FIXME: we need to read some of these variables from the MySQL DB.
$configvars = array(
$configvars = [
'BASEURL' => 'https://example.com/domjudge/',
'DOMJUDGE_VERSION' => 'unknown',
'SOURCESIZE' => 256,
'COMPILETIME' => 30,
'MEMLIMIT' => 524288,
'FILELIMIT' => 4096,
'PROCLIMIT' => 15,
'USERSUBMITDIR' => '.domjudge',
'SUBMITCLIENT_ENABLED' => 'yes',
);
];

foreach ($configvars as $var => $default) {
$value = defined($var) ? constant($var) : $default;
Expand Down

0 comments on commit 9124a46

Please sign in to comment.