[Openvpn-devel,v4] Add building man page on Windows

Message ID 20210825164752.808-1-lstipakov@gmail.com
State Accepted
Headers show
Series [Openvpn-devel,v4] Add building man page on Windows | expand

Commit Message

Lev Stipakov Aug. 25, 2021, 6:47 a.m. UTC
From: Lev Stipakov <lev@openvpn.net>

Use rst2html to build html from rst. Ignore errors,
this is not fatal and affects only MSI build.

Modify MSVC GitHub Actions to install python3/rst2html
and add html man page to artifacts.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---

 v4:
  - really replace "python3" with "python"

 v3:
  - replace "python3" with "python"

 v2:
  - change implementation to support GitHub Actions

 .github/workflows/build.yaml          | 9 +++++++++
 build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Comments

Samuli Seppänen Aug. 26, 2021, 1:14 a.m. UTC | #1
Il 25/08/21 19:47, Lev Stipakov ha scritto:
> From: Lev Stipakov <lev@openvpn.net>
> 
> Use rst2html to build html from rst. Ignore errors,
> this is not fatal and affects only MSI build.
> 
> Modify MSVC GitHub Actions to install python3/rst2html
> and add html man page to artifacts.
> 
> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
> 
>   v4:
>    - really replace "python3" with "python"
> 
>   v3:
>    - replace "python3" with "python"
> 
>   v2:
>    - change implementation to support GitHub Actions
> 
>   .github/workflows/build.yaml          | 9 +++++++++
>   build/msvc/msvc-generate/Makefile.mak | 9 ++++++++-
>   2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
> index 5d7dd37b..4cb2f4cc 100644
> --- a/.github/workflows/build.yaml
> +++ b/.github/workflows/build.yaml
> @@ -206,6 +206,14 @@ jobs:
>         - name: Add MSBuild to PATH
>           uses: microsoft/setup-msbuild@v1
>   
> +      - name: Set up Python
> +        uses: actions/setup-python@v2
> +        with:
> +          python-version: '3.x'
> +
> +      - name: Install rst2html
> +        run: python -m pip install --upgrade pip rst2html
> +
>         - name: Restore artifacts, or run vcpkg, build and cache artifacts
>           uses: lukka/run-vcpkg@main
>           with:
> @@ -227,3 +235,4 @@ jobs:
>             path: |
>               ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
>               ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
> +            doc/openvpn.8.html
> diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak
> index 59fc9f0e..6da859e3 100644
> --- a/build/msvc/msvc-generate/Makefile.mak
> +++ b/build/msvc/msvc-generate/Makefile.mak
> @@ -11,7 +11,10 @@ OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
>   INPUT_PLUGIN_CONFIG=version.m4.in
>   OUTPUT_PLUGIN_CONFIG=version.m4
>   
> -all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
> +INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
> +OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
> +
> +all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
>   
>   $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
>   	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
> @@ -22,7 +25,11 @@ $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
>   $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
>   	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
>   
> +$(OUTPUT_MAN): $(INPUT_MAN)
> +    -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
> +
>   clean:
>   	-del "$(OUTPUT_MSVC_VER)"
>   	-del "$(OUTPUT_PLUGIN)"
>   	-del "$(OUTPUT_PLUGIN_CONFIG)"
> +	-del "$(OUTPUT_MAN)"
> 

Works. ACK.

Samuli
Gert Doering Sept. 11, 2021, 11:26 p.m. UTC | #2
Your patch has been applied to the master branch.

commit d814581a9375713a0a4d70f751f84e750a5d661a
Author: Lev Stipakov
Date:   Wed Aug 25 19:47:52 2021 +0300

     Add building man page on Windows

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Samuli Seppänen <samuli@openvpn.net>
     Message-Id: <20210825164752.808-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22771.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Gert Doering Sept. 26, 2021, 11:52 p.m. UTC | #3
Hi,

On Sun, Sep 12, 2021 at 11:26:04AM +0200, Gert Doering wrote:
> Your patch has been applied to the master branch.
> 
> commit d814581a9375713a0a4d70f751f84e750a5d661a
> Author: Lev Stipakov
> Date:   Wed Aug 25 19:47:52 2021 +0300
> 
>      Add building man page on Windows

... and pulled up to release/2.5

commit 35c8281ef20de507dc08637bff02ce7895b48ec6 (HEAD -> release/2.5)
Author: Lev Stipakov <lev@openvpn.net>
Date:   Wed Aug 25 19:47:52 2021 +0300

    Add building man page on Windows

    (cherry picked from commit d814581a9375713a0a4d70f751f84e750a5d661a)

(one minor conflict due to the ".pdb" artefacts patch not being in 2.5,
but that was trivially solved)


I have not tested this myself, but Lev confirmed on IRC that it works
with 2.5 as well.

gert

Patch

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 5d7dd37b..4cb2f4cc 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -206,6 +206,14 @@  jobs:
       - name: Add MSBuild to PATH
         uses: microsoft/setup-msbuild@v1
 
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: '3.x'
+
+      - name: Install rst2html
+        run: python -m pip install --upgrade pip rst2html
+
       - name: Restore artifacts, or run vcpkg, build and cache artifacts
         uses: lukka/run-vcpkg@main
         with:
@@ -227,3 +235,4 @@  jobs:
           path: |
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
             ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
+            doc/openvpn.8.html
diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak
index 59fc9f0e..6da859e3 100644
--- a/build/msvc/msvc-generate/Makefile.mak
+++ b/build/msvc/msvc-generate/Makefile.mak
@@ -11,7 +11,10 @@  OUTPUT_PLUGIN=$(SOURCEBASE)/include/openvpn-plugin.h
 INPUT_PLUGIN_CONFIG=version.m4.in
 OUTPUT_PLUGIN_CONFIG=version.m4
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN)
+INPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.rst
+OUTPUT_MAN=$(SOURCEBASE)/doc/openvpn.8.html
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -22,7 +25,11 @@  $(OUTPUT_PLUGIN_CONFIG): $(INPUT_PLUGIN_CONFIG)
 $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 	cscript //nologo msvc-generate.js --config="$(OUTPUT_PLUGIN_CONFIG)" --input="$(INPUT_PLUGIN)" --output="$(OUTPUT_PLUGIN)"
 
+$(OUTPUT_MAN): $(INPUT_MAN)
+    -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
+	-del "$(OUTPUT_MAN)"