Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PDF creation with MSYS2 #28

Merged
merged 2 commits into from
Nov 7, 2022
Merged

Conversation

marcows
Copy link
Contributor

@marcows marcows commented Nov 7, 2022

There were two little regressions which caused the failed/wrong PDF creation.
CI only builds documentation using Linux in "QA" workflow, maybe it should be extended, @jtxa?

doc/CMakeLists.txt Outdated Show resolved Hide resolved
@jtxa
Copy link
Contributor

jtxa commented Nov 7, 2022

About the workflow:

Don't know if it is a long-lasting solution to have the documentation in QA. Perhaps for having the separate steps for every format and for future extra checks (like warning free).

If we want to test packaging on every platform, we need to build also the documentation on every platform.
So I suggest we add an additional step ninja package in the existing MSYS2 job, which includes documentation generation.

Until now, I just implemented what worked or I could easily get working. If you have an idea how to solve the solim error, then lets just do it. Please have a look here for the concrete error message.

Command "ps2pdf" could not be executed resulting in this cmd.exe error
message:
Der Befehl "C:\xxx\msys64\mingw64\bin\ps2pdf" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Regression introduced in commit c294e3a ("doc: Refactor CMake file",
2022-11-04), which removed the use of "sh" for script invocation, which
had been added in commit 1c41cfe ("Full Windows build, test and
packaging supported under MSYS2. Build documentation updated to cover
Windows and windows web page deprecated. Repo cleanup.", 2022-10-01).

However, the removal of "sh" was correct because it should not be
assumed whether an installed program is a shell script, python script,
binary executable or anything else.
It just didn't work in MSYS2 environment anymore because in build files
generated by CMake for Ninja or Make, the commands are executed via
cmd.exe, which cannot execute scripts directly.

Resulting command in "build.ninja" (shortened and formatted):

Broken:
COMMAND = cmd.exe /C "cd /D C:\xxx\srecord\build\doc
&& C:\xxx\msys64\mingw64\bin\ps2pdf
   C:/xxx/srecord/build/doc/BUILDING.pdf.ps
   C:/xxx/srecord/build/doc/BUILDING.pdf"

Fixed:
COMMAND = cmd.exe /C "cd /D C:\xxx\srecord\build\doc
&& sh C:/xxx/msys64/mingw64/bin/ps2pdf
   C:/xxx/srecord/build/doc/BUILDING.pdf.ps
   C:/xxx/srecord/build/doc/BUILDING.pdf"

The build also fails using "MinGW Makefiles" as generator.

Obviously, using "sh" here is not a universal solution because it relies
on "ps2pdf" being a shell script. But within the MSYS2 environment this
is the case currently and thus it's a pragmatic solution for now.
Script "ref_ptx.sh" could not be executed, but no error message
appeared. The build finished successfully, but the generated
"ref-parts.so" was empty so the man pages were missing from PDF.

Regression introduced in commit ecdf4df ("doc: Do not copy scripts to
build directory", 2022-11-04), which accidentally removed the use of
"sh" for script invocation of ref_ptx.sh only.
@sierrafoxtrot
Copy link
Owner

sierrafoxtrot commented Nov 7, 2022

Until now, I just implemented what worked or I could easily get working. If you have an idea how to solve the solim error, then lets just do it. Please have a look here for the concrete error message.

Regarding the error message, it includes:
cmd.exe /C "cd /DD:\a\srecord\srecord\build\doc && sh D:/a/srecord/srecord/doc/script/groff.sh -T ps -man -t -s -I/d/a/srecord/srecord/doc -I/d/a/srecord/srecord/build/doc D:/a/srecord/srecord/doc/etc/README.man > D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp && sh D:/a/srecord/srecord/doc/script/page_select.sh D:/a/srecord/srecord/doc/script/page-list.awk D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp D:/a/srecord/srecord/build/doc/README.pdf.ps && D:\a\srecord\srecord\build\doc\README.pdf.ps D:/a/srecord/srecord/build/doc/README.pdf && rm D:/a/srecord/srecord/build/doc/README.pdf.ps D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp"

This is likely the cause of the failure ie can't find ps2pdf. I can take a look tomorrow if someone else doesn't get to it first.

@sierrafoxtrot sierrafoxtrot merged commit 9d54e51 into sierrafoxtrot:master Nov 7, 2022
@marcows marcows deleted the msys2-pdf branch November 7, 2022 21:47
@marcows
Copy link
Contributor Author

marcows commented Nov 7, 2022

Until now, I just implemented what worked or I could easily get working. If you have an idea how to solve the solim error, then lets just do it. Please have a look here for the concrete error message.

Regarding the error message, it includes: cmd.exe /C "cd /DD:\a\srecord\srecord\build\doc && sh D:/a/srecord/srecord/doc/script/groff.sh -T ps -man -t -s -I/d/a/srecord/srecord/doc -I/d/a/srecord/srecord/build/doc D:/a/srecord/srecord/doc/etc/README.man > D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp && sh D:/a/srecord/srecord/doc/script/page_select.sh D:/a/srecord/srecord/doc/script/page-list.awk D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp D:/a/srecord/srecord/build/doc/README.pdf.ps && D:\a\srecord\srecord\build\doc\README.pdf.ps D:/a/srecord/srecord/build/doc/README.pdf && rm D:/a/srecord/srecord/build/doc/README.pdf.ps D:/a/srecord/srecord/build/doc/README.pdf.ps.tmp"

This is likely the cause of the failure ie can't find ps2pdf. I can take a look tomorrow if someone else doesn't get to it first.

find_program(PS2PDF ps2pdf) had been removed in jtxa@322b89c, which was used for the package run.

@marcows
Copy link
Contributor Author

marcows commented Nov 7, 2022

Until now, I just implemented what worked or I could easily get working. If you have an idea how to solve the solim error, then lets just do it. Please have a look here for the concrete error message.

I tested the workflow steps from your ci-msys2-doc branch locally and don't get soelim errors.
But it didn't succeed completely, it failed on step [60/61].

@jtxa
Copy link
Contributor

jtxa commented Nov 9, 2022

I solved the soelim problem on the workflow: groff or soelim cannot handle files with CRLF.
Tomorrow I'll do a PR which solves that problem and creates packages. It's almost done, just needs polishing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants