Skip to content

Commit 5d8c20b

Browse files
committed
release.sh: use docker for correct arxiv version
1 parent f234061 commit 5d8c20b

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

release.sh

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -ex
44

5+
TEXLIVE_DOCKER="texlive/texlive@sha256:18f1e85aecc7ad016159110c97eb15475325a9b42e86c9f0f554ba071f7207d3"
6+
57
# source: https://stackoverflow.com/questions/29436275/how-to-prompt-for-yes-or-no-in-bash
68
function yes_or_no {
79
while true; do
@@ -32,29 +34,52 @@ if [[ -e submission.tex ]] && [[ $1 -ef submission.tex ]]; then
3234
exit 1
3335
fi
3436

37+
if [[ ! -e graphicscache.sty ]]; then
38+
echo "Please copy graphicscache.sty to this directory to include it in the release."
39+
exit 1
40+
fi
41+
42+
if ! command -v docker || ! docker container ls &> /dev/null; then
43+
echo "Docker is not installed or you are not member of the docker group. Using your latex installation directly, but it might not match arXiv's one."
44+
function run() {
45+
"$@"
46+
}
47+
function run_in_test_release() {
48+
( cd test_release && "$@" )
49+
}
50+
else
51+
echo "Found docker, using it."
52+
function run() {
53+
docker run --rm --user $(id -u):$(id -g) -v $(pwd):$(pwd) -w $(pwd) ${TEXLIVE_DOCKER} "$@"
54+
}
55+
function run_in_test_release() {
56+
docker run --rm --user $(id -u):$(id -g) -v $(pwd)/test_release:$(pwd)/test_release -w $(pwd)/test_release ${TEXLIVE_DOCKER} "$@"
57+
}
58+
fi
59+
3560
echo "1) Running latexpand to strip comments and unify your .tex file..."
36-
latexpand --empty-comments $1 > submission.tex
61+
run latexpand --empty-comments $1 > submission.tex
3762

3863
echo
3964
echo "2) Running pdflatex (log in release.log)..."
40-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
41-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
65+
run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
66+
run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
4267

4368
if grep -F "run Biber on the file" release.log &> /dev/null; then
44-
biber submission
69+
run biber submission
4570
else
46-
bibtex submission
71+
run bibtex submission
4772
fi
4873

49-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
50-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
74+
run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
75+
run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
5176

5277
echo
5378
echo "3) Running pdflatex with render=false to determine needed files..."
5479
mv submission.tex submission.tex.orig
5580
echo '\makeatletter\def\graphicscache@inhibit{true}\makeatother' > submission.tex
5681
cat submission.tex.orig >> submission.tex
57-
pdflatex -shell-escape -interaction nonstopmode -recorder submission.tex &>> release.log
82+
run pdflatex -shell-escape -interaction nonstopmode -recorder submission.tex &>> release.log
5883

5984
grep "^INPUT" submission.fls \
6085
| cut -d ' ' --complement -f 1 \
@@ -90,14 +115,11 @@ if [[ -e test_release ]]; then
90115
fi
91116
fi
92117

93-
(
94-
mkdir test_release
95-
cd test_release
96-
tar xf ../release.tar
97-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
98-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
99-
pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
100-
)
118+
mkdir test_release
119+
tar -xf release.tar -C test_release
120+
run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
121+
run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
122+
run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log
101123

102124
echo
103125
echo "Finished. Please check test_release/submission.pdf for correctness."

0 commit comments

Comments
 (0)