DOMjudge / domjudge-packaging

DOMjudge packaging for (Linux) distributions and live image
31 stars 37 forks source link

Team manual rst2pdf error: No such file or directory: 'fc-match' #56

Closed tom93 closed 4 years ago

tom93 commented 4 years ago

The error occurs when the team manual is generated using sphinx-build/rst2pdf in the contributor and domserver Docker containers.

The rst2pdf package uses the fc-match command from the fontconfig package, but doesn't list it as a dependency for some reason so fontconfig isn't installed.

The build exit status is 0 (success), but the output includes a long error message and the generated file domjudge-team-manual.pdf is empty.

(The build happens to work in the gitlabci container because it installs packaging-dev, which pulls in fontconfig.)

Steps to reproduce

git clone https://github.com/DOMjudge/domjudge.git
cd domjudge
git checkout 656477610b41
docker run -v $PWD:/domjudge -it domjudge/domjudge-contributor@sha256:b4cc5d9069aac62497e39ee320b199cd31fe5bc72499fed96a5fd505990607a7

Expected behaviour

domjudge/doc/manual/build/team/domjudge-team-manual.pdf should contain the team manual.

Actual behaviour

domjudge-team-manual.pdf exists but is empty.

Build output

``` ... make html team make[2]: Entering directory '/domjudge/doc/manual' ... sphinx-build -b pdf . build/team Running Sphinx v1.6.7 making output directory... loading translations [en]... done loading pickled environment... not yet created building [mo]: targets for 0 po files that are out of date building [pdf]: targets for 18 source files that are out of date updating environment: 18 added, 0 changed, 0 removed reading sources... [100%] upgrading looking for now-outdated files... none found pickling environment... done checking consistency... done processing domjudge-team-manual... team resolving references... done writing domjudge-team-manual... [ERROR] pdfbuilder.py:149 [Errno 2] No such file or directory: 'fc-match': 'fc-match' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/rst2pdf/pdfbuilder.py", line 146, in write docwriter.write(doctree, destination) File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 80, in write self.translate() File "/usr/local/lib/python3.6/dist-packages/rst2pdf/pdfbuilder.py", line 643, in translate section_header_depth=self.section_header_depth File "/usr/local/lib/python3.6/dist-packages/rst2pdf/createpdf.py", line 173, in __init__ self.loadStyles(stylesheets) File "/usr/local/lib/python3.6/dist-packages/rst2pdf/createpdf.py", line 276, in loadStyles def_dpi=self.def_dpi) File "/usr/local/lib/python3.6/dist-packages/rst2pdf/styles.py", line 358, in __init__ fontList = findfonts.autoEmbed(style[key]) File "/usr/local/lib/python3.6/dist-packages/rst2pdf/findfonts.py", line 322, in autoEmbed variants = findTTFont(fname) File "/usr/local/lib/python3.6/dist-packages/rst2pdf/findfonts.py", line 214, in findTTFont family = get_family(fname) File "/usr/local/lib/python3.6/dist-packages/rst2pdf/findfonts.py", line 178, in get_family data = make_string(subprocess.check_output(["fc-match", query])) File "/usr/lib/python3.6/subprocess.py", line 356, in check_output **kwargs).stdout File "/usr/lib/python3.6/subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'fc-match': 'fc-match' FAILED build succeeded. make[2]: Leaving directory '/domjudge/doc/manual' ... ```

Fix

The obvious fix is to install fontconfig. There may be other solutions though, I'm not familiar with rst2pdf.

Pull request

57, DOMjudge/domjudge#797 (for install instructions)

thijskh commented 4 years ago

Thanks! This is indeed the case.

I’ve filed https://bugs.debian.org/960571 to get the package’s dependencies updated.

And rst2pdf/rst2pdf#864 about the build succeeding even though there are errors.

But indeed for now we need to install fontconfig explicitly.