* [PATCH v2 0/4] Fixes docs building on msys2/mingw
@ 2020-10-15 20:10 Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 1/4] docs: Fixes build docs " Yonggang Luo
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Yonggang Luo @ 2020-10-15 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Yonggang Luo
v1 - v2
Also move the docs configure part from
configure to meson, this also fixed the pending
ninjatool removal caused issue that docs can
not be build under msys2/mingw
Yonggang Luo (4):
docs: Fixes build docs on msys2/mingw
configure: the docdir option should passed to meson as is.
meson: Move the detection logic for sphinx to meson
cirrus: Enable doc build on msys2/mingw
.cirrus.yml | 6 +++-
configure | 62 +++--------------------------------
docs/conf.py | 2 +-
docs/meson.build | 4 +--
docs/sphinx/kerneldoc.py | 2 +-
meson.build | 59 +++++++++++++++++++++++++++++----
meson_options.txt | 5 ++-
scripts/rst-sanitize.py | 21 ++++++++++++
tests/qapi-schema/meson.build | 7 ++--
9 files changed, 95 insertions(+), 73 deletions(-)
create mode 100644 scripts/rst-sanitize.py
--
2.28.0.windows.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
@ 2020-10-15 20:10 ` Yonggang Luo
2020-10-15 20:30 ` Peter Maydell
2020-10-15 20:10 ` [PATCH v2 2/4] configure: the docdir option should passed to meson as is Yonggang Luo
` (3 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Yonggang Luo @ 2020-10-15 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Yonggang Luo
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
docs/conf.py | 2 +-
docs/sphinx/kerneldoc.py | 2 +-
scripts/rst-sanitize.py | 21 +++++++++++++++++++++
tests/qapi-schema/meson.build | 5 +++--
4 files changed, 26 insertions(+), 4 deletions(-)
create mode 100644 scripts/rst-sanitize.py
diff --git a/docs/conf.py b/docs/conf.py
index 00e1b750e2..e584f68393 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -241,7 +241,7 @@ texinfo_documents = [
# We use paths starting from qemu_docdir here so that you can run
# sphinx-build from anywhere and the kerneldoc extension can still
# find everything.
-kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
+kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
kerneldoc_srctree = os.path.join(qemu_docdir, '..')
hxtool_srctree = os.path.join(qemu_docdir, '..')
qapidoc_srctree = os.path.join(qemu_docdir, '..')
diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
index 3e87940206..3ac277d162 100644
--- a/docs/sphinx/kerneldoc.py
+++ b/docs/sphinx/kerneldoc.py
@@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
def run(self):
env = self.state.document.settings.env
- cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
+ cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
export_file_patterns = []
diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
new file mode 100644
index 0000000000..26060f1208
--- /dev/null
+++ b/scripts/rst-sanitize.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+#
+# Script for remove cr line ending in file
+#
+# Authors:
+# Yonggang Luo <luoyonggang@gmail.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or, at your option, any later version. See the COPYING file in
+# the top-level directory.
+
+import sys
+
+def main(_program, file, *unused):
+ with open(file, 'rb') as content_file:
+ content = content_file.read()
+ sys.stdout.buffer.write(content.replace(b'\r', b''))
+
+if __name__ == "__main__":
+ main(*sys.argv)
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index 1f222a7a13..20a7641af8 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
# using an explicit '\' character in the command arguments to
# a custom_target(), as Meson will unhelpfully replace it with a '/'
# (https://github.com/mesonbuild/meson/issues/1564)
+rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'), '@INPUT@']
qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
output: ['doc-good.txt.nocr'],
input: qapi_doc_out[0],
build_by_default: build_docs,
- command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
+ command: rst_sanitize_cmd,
capture: true)
qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
output: ['doc-good.ref.nocr'],
input: files('doc-good.txt'),
build_by_default: build_docs,
- command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
+ command: rst_sanitize_cmd,
capture: true)
if build_docs
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/4] configure: the docdir option should passed to meson as is.
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 1/4] docs: Fixes build docs " Yonggang Luo
@ 2020-10-15 20:10 ` Yonggang Luo
2020-10-15 21:23 ` Paolo Bonzini
2020-10-15 20:10 ` [PATCH v2 3/4] meson: Move the detection logic for sphinx to meson Yonggang Luo
` (2 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Yonggang Luo @ 2020-10-15 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Yonggang Luo
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
configure | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/configure b/configure
index f839c2a557..1ce31f97b4 100755
--- a/configure
+++ b/configure
@@ -971,7 +971,7 @@ for opt do
;;
--with-suffix=*) qemu_suffix="$optarg"
;;
- --docdir=*) qemu_docdir="$optarg"
+ --docdir=*) docdir="$optarg"
;;
--sysconfdir=*) sysconfdir="$optarg"
;;
@@ -5770,7 +5770,6 @@ fi
qemu_confdir="$sysconfdir/$qemu_suffix"
qemu_moddir="$libdir/$qemu_suffix"
qemu_datadir="$datadir/$qemu_suffix"
-qemu_docdir="$docdir/$qemu_suffix"
qemu_localedir="$datadir/locale"
qemu_icondir="$datadir/icons"
qemu_desktopdir="$datadir/applications"
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 3/4] meson: Move the detection logic for sphinx to meson
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 1/4] docs: Fixes build docs " Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 2/4] configure: the docdir option should passed to meson as is Yonggang Luo
@ 2020-10-15 20:10 ` Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 4/4] cirrus: Enable doc build on msys2/mingw Yonggang Luo
2020-10-15 21:52 ` [PATCH v2 0/4] Fixes docs building " Paolo Bonzini
4 siblings, 0 replies; 13+ messages in thread
From: Yonggang Luo @ 2020-10-15 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Yonggang Luo
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
configure | 59 +++--------------------------------
docs/meson.build | 4 +--
meson.build | 59 ++++++++++++++++++++++++++++++-----
meson_options.txt | 5 ++-
tests/qapi-schema/meson.build | 2 +-
5 files changed, 63 insertions(+), 66 deletions(-)
diff --git a/configure b/configure
index 1ce31f97b4..ff593a8542 100755
--- a/configure
+++ b/configure
@@ -297,7 +297,7 @@ brlapi=""
curl=""
iconv="auto"
curses="auto"
-docs=""
+docs="auto"
fdt="auto"
netmap="no"
sdl="auto"
@@ -822,15 +822,6 @@ do
fi
done
-sphinx_build=
-for binary in sphinx-build-3 sphinx-build
-do
- if has "$binary"
- then
- sphinx_build=$(command -v "$binary")
- break
- fi
-done
# Check for ancillary tools used in testing
genisoimage=
@@ -1226,9 +1217,9 @@ for opt do
;;
--disable-crypto-afalg) crypto_afalg="no"
;;
- --disable-docs) docs="no"
+ --disable-docs) docs="disabled"
;;
- --enable-docs) docs="yes"
+ --enable-docs) docs="enabled"
;;
--disable-vhost-net) vhost_net="no"
;;
@@ -4413,45 +4404,6 @@ if check_include linux/btrfs.h ; then
btrfs=yes
fi
-# If we're making warnings fatal, apply this to Sphinx runs as well
-sphinx_werror=""
-if test "$werror" = "yes"; then
- sphinx_werror="-W"
-fi
-
-# Check we have a new enough version of sphinx-build
-has_sphinx_build() {
- # This is a bit awkward but works: create a trivial document and
- # try to run it with our configuration file (which enforces a
- # version requirement). This will fail if either
- # sphinx-build doesn't exist at all or if it is too old.
- mkdir -p "$TMPDIR1/sphinx"
- touch "$TMPDIR1/sphinx/index.rst"
- "$sphinx_build" $sphinx_werror -c "$source_path/docs" \
- -b html "$TMPDIR1/sphinx" \
- "$TMPDIR1/sphinx/out" >> config.log 2>&1
-}
-
-# Check if tools are available to build documentation.
-if test "$docs" != "no" ; then
- if has_sphinx_build; then
- sphinx_ok=yes
- else
- sphinx_ok=no
- fi
- if test "$sphinx_ok" = "yes"; then
- docs=yes
- else
- if test "$docs" = "yes" ; then
- if has $sphinx_build && test "$sphinx_ok" != "yes"; then
- echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2
- fi
- feature_not_found "docs" "Install a Python 3 version of python-sphinx"
- fi
- docs=no
- fi
-fi
-
# Search for bswap_32 function
byteswap_h=no
cat > $TMPC << EOF
@@ -6087,9 +6039,6 @@ qemu_version=$(head $source_path/VERSION)
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak
-if [ "$docs" = "yes" ] ; then
- echo "BUILD_DOCS=yes" >> $config_host_mak
-fi
if test "$modules" = "yes"; then
# $shacmd can generate a hash started with digit, which the compiler doesn't
# like as an symbol. So prefix it with an underscore
@@ -6794,7 +6743,6 @@ fi
echo "ROMS=$roms" >> $config_host_mak
echo "MAKE=$make" >> $config_host_mak
echo "PYTHON=$python" >> $config_host_mak
-echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
echo "MESON=$meson" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
@@ -7076,6 +7024,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
-Diconv=$iconv -Dcurses=$curses \
+ -Ddocs=$docs -Dsphinx_build=$sphinx_build \
$cross_arg \
"$PWD" "$source_path"
diff --git a/docs/meson.build b/docs/meson.build
index 0340d489ac..f566809a6a 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -37,7 +37,7 @@ if build_docs
input: [files('conf.py'), files(manual / 'conf.py')],
depfile: manual + '.d',
depend_files: sphinx_extn_depends,
- command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
+ command: SPHINX_ARGS + ['-Ddepfile=@DEPFILE@',
'-Ddepfile_stamp=@OUTPUT0@',
'-b', 'html', '-d', private_dir,
input_dir, output_dir])
@@ -59,7 +59,7 @@ if build_docs
input: this_manual,
install: build_docs,
install_dir: install_dirs,
- command: [SPHINX_ARGS, '-b', 'man', '-d', private_dir,
+ command: SPHINX_ARGS + ['-b', 'man', '-d', private_dir,
input_dir, meson.current_build_dir()])
endif
endforeach
diff --git a/meson.build b/meson.build
index 8156df8b71..3cf54d82f6 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,13 @@ cc = meson.get_compiler('c')
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
enable_modules = 'CONFIG_MODULES' in config_host
enable_static = 'CONFIG_STATIC' in config_host
-build_docs = 'BUILD_DOCS' in config_host
+
+# Temporary directory used for files created while
+# configure runs. Since it is in the build directory
+# we can safely blow away any previous version of it
+# (and we need not jump through hoops to try to delete
+# it when configure exits.)
+tmpdir = meson.current_build_dir() / 'config-temp'
if get_option('qemu_suffix').startswith('/')
error('qemu_suffix cannot start with a /')
@@ -1235,14 +1241,53 @@ foreach d : hx_headers
endforeach
genh += hxdep
-SPHINX_ARGS = [config_host['SPHINX_BUILD'],
- '-Dversion=' + meson.project_version(),
- '-Drelease=' + config_host['PKGVERSION']]
+sphinx_build = not_found
+sphinx_build_option = get_option('sphinx_build')
+if sphinx_build_option == ''
+ sphinx_build = find_program('sphinx-build', required: false)
+else
+ sphinx_build = find_program(sphinx_build_option, required: false)
+endif
+SPHINX_TEST_ARGS = []
+# If we're making warnings fatal, apply this to Sphinx runs as well
if get_option('werror')
- SPHINX_ARGS += [ '-W' ]
+ SPHINX_TEST_ARGS += [ '-W' ]
+endif
+
+build_docs = false
+docs_option = get_option('docs')
+# Check if tools are available to build documentation.
+if sphinx_build.found() and not docs_option.disabled()
+ # This is a bit awkward but works: create a trivial document and
+ # try to run it with our configuration file (which enforces a
+ # version requirement). This will fail if either
+ # sphinx-build doesn't exist at all or if it is too old.
+ run_command('mkdir', ['-p', tmpdir / 'sphinx'])
+ run_command('touch', [tmpdir / 'sphinx/index.rst'])
+ sphinx_build_test_out = run_command(sphinx_build, SPHINX_TEST_ARGS + [
+ '-c', meson.current_source_dir() / 'docs',
+ '-b', 'html', tmpdir / 'sphinx',
+ tmpdir / 'sphinx/out'])
+ message(sphinx_build_test_out.stderr())
+ message(sphinx_build_test_out.stdout())
+ if sphinx_build_test_out.returncode() == 0
+ build_docs = true
+ else
+ if docs_option.enabled()
+ if sphinx_build_option != ''
+ warning('Warning: @0@ exists but it is either too old or uses too old a Python version'.format(sphinx_build_option))
+ endif
+ error('Warning: Install a Python 3 version of python-sphinx')
+ endif
+ # do not building docs
+ endif
endif
+SPHINX_ARGS = [sphinx_build]
+SPHINX_ARGS += SPHINX_TEST_ARGS
+SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
+
sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
meson.source_root() / 'docs/sphinx/hxtool.py',
meson.source_root() / 'docs/sphinx/kerneldoc.py',
@@ -1918,7 +1963,7 @@ summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
summary_info += {'make': config_host['MAKE']}
summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
-summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
+summary_info += {'sphinx-build': sphinx_build.found()}
summary_info += {'genisoimage': config_host['GENISOIMAGE']}
# TODO: add back version
summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt}
@@ -1986,7 +2031,7 @@ if config_host.has_key('CONFIG_XEN_BACKEND')
summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
endif
summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
-summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
+summary_info += {'Documentation': build_docs}
summary_info += {'PIE': get_option('b_pie')}
summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
diff --git a/meson_options.txt b/meson_options.txt
index e6cb1e589b..0e3fa7136b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,8 +1,11 @@
option('qemu_suffix', type : 'string', value: 'qemu',
description: 'Suffix for QEMU data/modules/config directories (can be empty)')
+option('docs', type : 'feature', value : 'auto',
+ description: 'Documentations build support')
option('docdir', type : 'string', value : 'doc',
description: 'Base directory for documentation installation (can be empty)')
-
+option('sphinx_build', type : 'string', value : '',
+ description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
option('gettext', type : 'boolean', value : true,
description: 'Localization of the GTK+ user interface')
option('sparse', type : 'feature', value : 'auto',
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index 20a7641af8..e36079cece 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -237,7 +237,7 @@ qapi_doc_out = custom_target('QAPI rST doc',
# we want it to always really run the QAPI doc
# generation code. It also means we don't
# clutter up the build dir with the cache.
- command: [SPHINX_ARGS,
+ command: SPHINX_ARGS + [
'-b', 'text', '-E',
'-c', meson.source_root() / 'docs',
'-D', 'master_doc=doc-good',
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 4/4] cirrus: Enable doc build on msys2/mingw
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
` (2 preceding siblings ...)
2020-10-15 20:10 ` [PATCH v2 3/4] meson: Move the detection logic for sphinx to meson Yonggang Luo
@ 2020-10-15 20:10 ` Yonggang Luo
2020-10-15 21:52 ` [PATCH v2 0/4] Fixes docs building " Paolo Bonzini
4 siblings, 0 replies; 13+ messages in thread
From: Yonggang Luo @ 2020-10-15 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Yonggang Luo
Currently rST depends on old version sphinx-2.x.
Install it by downloading it.
Remove the need of university mirror, the main repo are recovered.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
.cirrus.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 99d118239c..f42ccb956a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -76,7 +76,6 @@ windows_msys2_task:
((Get-Content -path C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path C:\tools\msys64\etc\\post-install\\07-pacman-key.post
C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
C:\tools\msys64\usr\bin\bash.exe -lc "export"
- C:\tools\msys64\usr\bin\bash.exe -lc "grep -rl 'repo.msys2.org/' /etc/pacman.d/mirrorlist.* | xargs sed -i 's/repo.msys2.org\//mirrors.tuna.tsinghua.edu.cn\/msys2\//g'"
C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu --overwrite=*
taskkill /F /FI "MODULES eq msys-2.0.dll"
@@ -111,6 +110,11 @@ windows_msys2_task:
mingw-w64-x86_64-curl \
mingw-w64-x86_64-gnutls \
"
+ bitsadmin /transfer msys_download /dynamic /download /priority FOREGROUND `
+ https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz `
+ C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
+ C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U /c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
+ del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*"
cd C:\tools\msys64
echo "Start archive"
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
2020-10-15 20:10 ` [PATCH v2 1/4] docs: Fixes build docs " Yonggang Luo
@ 2020-10-15 20:30 ` Peter Maydell
2020-10-15 20:38 ` 罗勇刚(Yonggang Luo)
2020-10-15 21:22 ` Paolo Bonzini
0 siblings, 2 replies; 13+ messages in thread
From: Peter Maydell @ 2020-10-15 20:30 UTC (permalink / raw)
To: Yonggang Luo; +Cc: Paolo Bonzini, QEMU Developers
On Thu, 15 Oct 2020 at 21:13, Yonggang Luo <luoyonggang@gmail.com> wrote:
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> docs/conf.py | 2 +-
> docs/sphinx/kerneldoc.py | 2 +-
> scripts/rst-sanitize.py | 21 +++++++++++++++++++++
> tests/qapi-schema/meson.build | 5 +++--
> 4 files changed, 26 insertions(+), 4 deletions(-)
> create mode 100644 scripts/rst-sanitize.py
>
> diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
> new file mode 100644
> index 0000000000..26060f1208
> --- /dev/null
> +++ b/scripts/rst-sanitize.py
> @@ -0,0 +1,21 @@
> +#!/usr/bin/env python3
> +
> +#
> +# Script for remove cr line ending in file
> +#
> +# Authors:
> +# Yonggang Luo <luoyonggang@gmail.com>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2
> +# or, at your option, any later version. See the COPYING file in
> +# the top-level directory.
> +
> +import sys
> +
> +def main(_program, file, *unused):
> + with open(file, 'rb') as content_file:
> + content = content_file.read()
> + sys.stdout.buffer.write(content.replace(b'\r', b''))
> +
> +if __name__ == "__main__":
> + main(*sys.argv)
Why doesn't the perl rune work? Your commit message doesn't say.
> diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
> index 1f222a7a13..20a7641af8 100644
> --- a/tests/qapi-schema/meson.build
> +++ b/tests/qapi-schema/meson.build
> @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
> # using an explicit '\' character in the command arguments to
> # a custom_target(), as Meson will unhelpfully replace it with a '/'
> # (https://github.com/mesonbuild/meson/issues/1564)
> +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'), '@INPUT@']
> qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
> output: ['doc-good.txt.nocr'],
> input: qapi_doc_out[0],
> build_by_default: build_docs,
> - command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
> + command: rst_sanitize_cmd,
> capture: true)
>
> qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
> output: ['doc-good.ref.nocr'],
> input: files('doc-good.txt'),
> build_by_default: build_docs,
> - command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
> + command: rst_sanitize_cmd,
> capture: true)
thanks
-- PMM
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
2020-10-15 20:30 ` Peter Maydell
@ 2020-10-15 20:38 ` 罗勇刚(Yonggang Luo)
2020-10-15 21:22 ` Paolo Bonzini
1 sibling, 0 replies; 13+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-10-15 20:38 UTC (permalink / raw)
To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 17789 bytes --]
On Fri, Oct 16, 2020 at 4:30 AM Peter Maydell <peter.maydell@linaro.org>
wrote:
>
> On Thu, 15 Oct 2020 at 21:13, Yonggang Luo <luoyonggang@gmail.com> wrote:
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> > docs/conf.py | 2 +-
> > docs/sphinx/kerneldoc.py | 2 +-
> > scripts/rst-sanitize.py | 21 +++++++++++++++++++++
> > tests/qapi-schema/meson.build | 5 +++--
> > 4 files changed, 26 insertions(+), 4 deletions(-)
> > create mode 100644 scripts/rst-sanitize.py
> >
> > diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
> > new file mode 100644
> > index 0000000000..26060f1208
> > --- /dev/null
> > +++ b/scripts/rst-sanitize.py
> > @@ -0,0 +1,21 @@
> > +#!/usr/bin/env python3
> > +
> > +#
> > +# Script for remove cr line ending in file
> > +#
> > +# Authors:
> > +# Yonggang Luo <luoyonggang@gmail.com>
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2
> > +# or, at your option, any later version. See the COPYING file in
> > +# the top-level directory.
> > +
> > +import sys
> > +
> > +def main(_program, file, *unused):
> > + with open(file, 'rb') as content_file:
> > + content = content_file.read()
> > + sys.stdout.buffer.write(content.replace(b'\r', b''))
> > +
> > +if __name__ == "__main__":
> > + main(*sys.argv)
>
> Why doesn't the perl rune work? Your commit message doesn't say.
PASS 3 test-qdev-global-props /qdev/properties/dynamic/global
PASS 4 test-qdev-global-props /qdev/properties/global/subclass
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
../../../../../CI-Tools/msys64/usr/bin/sh.EXE
C:/work/xemu/qemu/build/../tests/decode/check.sh python3 -B
C:/work/xemu/qemu/build/../tests/../scripts/decodetree.py
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
PYTHONPATH=C:/work/xemu/qemu/scripts PYTHONIOENCODING=utf-8
../../../../CI-Tools/msys64/mingw64/bin/python3.exe
C:/work/xemu/qemu/build/../tests/qapi-schema/test-qapi.py
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-any.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-array.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-branch-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-clash.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-enum-bool.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-enum-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-bool-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-num-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-nested.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-alternate.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-any.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-array-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-array-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-bad-boxed.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-boxed-anon.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-boxed-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-array-bad.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-case.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-name-clash.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-union.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-data.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-ident.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-empty-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-bool.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/base-cycle-direct.json
C:/work/xemu/qemu/build/../tests/qapi-schema/base-cycle-indirect.json
C:/work/xemu/qemu/build/../tests/qapi-schema/command-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/comments.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-alternate-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-boxed-command-arg.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-command-arg.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-enum-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-event-arg.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-feature.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-indent.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-section.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-symbol.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-bad-union-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-before-include.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-before-pragma.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-duplicated-arg.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-duplicated-return.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-duplicated-since.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-empty-arg.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-empty-section.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-empty-symbol.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-good.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-interleaved-section.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-invalid-end.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-invalid-end2.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-invalid-return.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-invalid-section.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-invalid-start.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-missing-colon.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-missing-expr.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-missing-space.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-missing.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-no-symbol.json
C:/work/xemu/qemu/build/../tests/qapi-schema/doc-undoc-feature.json
C:/work/xemu/qemu/build/../tests/qapi-schema/double-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/duplicate-key.json
C:/work/xemu/qemu/build/../tests/qapi-schema/empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-bad-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-bad-name.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-bad-prefix.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-clash-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-dict-member-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-int-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-member-case.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-missing-data.json
C:/work/xemu/qemu/build/../tests/qapi-schema/enum-wrong-data.json
C:/work/xemu/qemu/build/../tests/qapi-schema/event-boxed-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/event-case.json
C:/work/xemu/qemu/build/../tests/qapi-schema/event-member-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/event-nest-struct.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-bad-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-deprecated-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-duplicate-name.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-missing-name.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-name-bad-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-no-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/features-unknown-key.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-array-branch.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-bad-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-bad-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-base-any.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-base-union.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-clash-member.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-discriminator-bad-name.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-inline.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-inline-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-int-branch.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-invalid-branch-key.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-invalid-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-invalid-if-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-no-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-optional-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/flat-union-string-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/funny-char.json
C:/work/xemu/qemu/build/../tests/qapi-schema/funny-word.json
C:/work/xemu/qemu/build/../tests/qapi-schema/ident-with-escape.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-before-err.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-cycle.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-extra-junk.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-nested-err.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-no-file.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-non-file.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-repetition.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-self-cycle.json
C:/work/xemu/qemu/build/../tests/qapi-schema/include-simple.json
C:/work/xemu/qemu/build/../tests/qapi-schema/indented-expr.json
C:/work/xemu/qemu/build/../tests/qapi-schema/leading-comma-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/leading-comma-object.json
C:/work/xemu/qemu/build/../tests/qapi-schema/missing-colon.json
C:/work/xemu/qemu/build/../tests/qapi-schema/missing-comma-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/missing-comma-object.json
C:/work/xemu/qemu/build/../tests/qapi-schema/missing-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/nested-struct-data.json
C:/work/xemu/qemu/build/../tests/qapi-schema/nested-struct-data-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/non-objects.json
C:/work/xemu/qemu/build/../tests/qapi-schema/oob-coroutine.json
C:/work/xemu/qemu/build/../tests/qapi-schema/oob-test.json
C:/work/xemu/qemu/build/../tests/qapi-schema/allow-preconfig-test.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-doc-required-crap.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-extra-junk.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-name-case-whitelist-crap.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-non-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/pragma-returns-whitelist-crap.json
C:/work/xemu/qemu/build/../tests/qapi-schema/qapi-schema-test.json
C:/work/xemu/qemu/build/../tests/qapi-schema/quoted-structural-chars.json
C:/work/xemu/qemu/build/../tests/qapi-schema/redefined-builtin.json
C:/work/xemu/qemu/build/../tests/qapi-schema/redefined-command.json
C:/work/xemu/qemu/build/../tests/qapi-schema/redefined-event.json
C:/work/xemu/qemu/build/../tests/qapi-schema/redefined-type.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-command-q.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-enum-q.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-member-has.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-member-q.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-member-u.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-member-underscore.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-type-kind.json
C:/work/xemu/qemu/build/../tests/qapi-schema/reserved-type-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/returns-alternate.json
C:/work/xemu/qemu/build/../tests/qapi-schema/returns-array-bad.json
C:/work/xemu/qemu/build/../tests/qapi-schema/returns-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/returns-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/returns-whitelist.json
C:/work/xemu/qemu/build/../tests/qapi-schema/string-code-point-31.json
C:/work/xemu/qemu/build/../tests/qapi-schema/string-code-point-127.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-base-clash-deep.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-base-clash.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-data-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-member-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-member-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/struct-member-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/trailing-comma-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/trailing-comma-object.json
C:/work/xemu/qemu/build/../tests/qapi-schema/type-bypass-bad-gen.json
C:/work/xemu/qemu/build/../tests/qapi-schema/unclosed-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/unclosed-object.json
C:/work/xemu/qemu/build/../tests/qapi-schema/unclosed-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-base-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-base-no-discriminator.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-branch-case.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-branch-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-branch-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-clash-branches.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-invalid-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-optional-branch.json
C:/work/xemu/qemu/build/../tests/qapi-schema/union-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/unknown-escape.json
C:/work/xemu/qemu/build/../tests/qapi-schema/unknown-expr-key.json
"C:/CI-Tools/msys64/mingw64/bin/python3.exe"
"C:/work/xemu/qemu/meson/meson.py" "--internal" "exe" "--capture"
"tests/qapi-schema/doc-good.ref.nocr" "--" "perl" "-pe" "$x = chr 13;
s/$x$//" "../tests/qapi-schema/doc-good.txt" && if test -e
tests/qapi-schema/doc-good.ref.nocr; then printf '%s\n'
tests/qapi-schema/doc-good.ref.nocr >
tests/qapi-schema/doc-good.ref.nocr.stamp; fi
syntax error at -e line 1, near "="
Execution of -e aborted due to compilation errors.
make: *** [Makefile.ninja:2572:tests/qapi-schema/doc-good.ref.nocr.stamp]
错误 255
>
> > diff --git a/tests/qapi-schema/meson.build
b/tests/qapi-schema/meson.build
> > index 1f222a7a13..20a7641af8 100644
> > --- a/tests/qapi-schema/meson.build
> > +++ b/tests/qapi-schema/meson.build
> > @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
> > # using an explicit '\' character in the command arguments to
> > # a custom_target(), as Meson will unhelpfully replace it with a '/'
> > # (https://github.com/mesonbuild/meson/issues/1564)
> > +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'),
'@INPUT@']
> > qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
> > output: ['doc-good.txt.nocr'],
> > input: qapi_doc_out[0],
> > build_by_default: build_docs,
> > - command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
> > + command: rst_sanitize_cmd,
> > capture: true)
> >
> > qapi_doc_ref_nocr = custom_target('QAPI rST doc reference
newline-sanitized',
> > output: ['doc-good.ref.nocr'],
> > input: files('doc-good.txt'),
> > build_by_default: build_docs,
> > - command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
> > + command: rst_sanitize_cmd,
> > capture: true)
>
> thanks
> -- PMM
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 19041 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
2020-10-15 20:30 ` Peter Maydell
2020-10-15 20:38 ` 罗勇刚(Yonggang Luo)
@ 2020-10-15 21:22 ` Paolo Bonzini
2020-10-15 21:33 ` 罗勇刚(Yonggang Luo)
1 sibling, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2020-10-15 21:22 UTC (permalink / raw)
To: Peter Maydell; +Cc: Yonggang Luo, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 3172 bytes --]
Il gio 15 ott 2020, 22:30 Peter Maydell <peter.maydell@linaro.org> ha
scritto:
> On Thu, 15 Oct 2020 at 21:13, Yonggang Luo <luoyonggang@gmail.com> wrote:
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > ---
> > docs/conf.py | 2 +-
> > docs/sphinx/kerneldoc.py | 2 +-
> > scripts/rst-sanitize.py | 21 +++++++++++++++++++++
> > tests/qapi-schema/meson.build | 5 +++--
> > 4 files changed, 26 insertions(+), 4 deletions(-)
> > create mode 100644 scripts/rst-sanitize.py
> >
> > diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
> > new file mode 100644
> > index 0000000000..26060f1208
> > --- /dev/null
> > +++ b/scripts/rst-sanitize.py
> > @@ -0,0 +1,21 @@
> > +#!/usr/bin/env python3
> > +
> > +#
> > +# Script for remove cr line ending in file
> > +#
> > +# Authors:
> > +# Yonggang Luo <luoyonggang@gmail.com>
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2
> > +# or, at your option, any later version. See the COPYING file in
> > +# the top-level directory.
> > +
> > +import sys
> > +
> > +def main(_program, file, *unused):
> > + with open(file, 'rb') as content_file:
> > + content = content_file.read()
> > + sys.stdout.buffer.write(content.replace(b'\r', b''))
> > +
> > +if __name__ == "__main__":
> > + main(*sys.argv)
>
> Why doesn't the perl rune work? Your commit message doesn't say.
>
Ninjatool gets confused by Windows escapes. So it's a QEMU-ism and
switching to ninja fixes it. There's no need to use a separate script for
this.
Paolo
> > diff --git a/tests/qapi-schema/meson.build
> b/tests/qapi-schema/meson.build
> > index 1f222a7a13..20a7641af8 100644
> > --- a/tests/qapi-schema/meson.build
> > +++ b/tests/qapi-schema/meson.build
> > @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
> > # using an explicit '\' character in the command arguments to
> > # a custom_target(), as Meson will unhelpfully replace it with a '/'
> > # (https://github.com/mesonbuild/meson/issues/1564)
> > +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'),
> '@INPUT@']
> > qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
> > output: ['doc-good.txt.nocr'],
> > input: qapi_doc_out[0],
> > build_by_default: build_docs,
> > - command: ['perl', '-pe', '$x = chr
> 13; s/$x$//', '@INPUT@'],
> > + command: rst_sanitize_cmd,
> > capture: true)
> >
> > qapi_doc_ref_nocr = custom_target('QAPI rST doc reference
> newline-sanitized',
> > output: ['doc-good.ref.nocr'],
> > input: files('doc-good.txt'),
> > build_by_default: build_docs,
> > - command: ['perl', '-pe', '$x = chr
> 13; s/$x$//', '@INPUT@'],
> > + command: rst_sanitize_cmd,
> > capture: true)
>
> thanks
> -- PMM
>
>
[-- Attachment #2: Type: text/html, Size: 4923 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/4] configure: the docdir option should passed to meson as is.
2020-10-15 20:10 ` [PATCH v2 2/4] configure: the docdir option should passed to meson as is Yonggang Luo
@ 2020-10-15 21:23 ` Paolo Bonzini
2020-10-15 21:39 ` 罗勇刚(Yonggang Luo)
0 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2020-10-15 21:23 UTC (permalink / raw)
To: Yonggang Luo; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
Why?
Paolo
Il gio 15 ott 2020, 22:11 Yonggang Luo <luoyonggang@gmail.com> ha scritto:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> configure | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index f839c2a557..1ce31f97b4 100755
> --- a/configure
> +++ b/configure
> @@ -971,7 +971,7 @@ for opt do
> ;;
> --with-suffix=*) qemu_suffix="$optarg"
> ;;
> - --docdir=*) qemu_docdir="$optarg"
> + --docdir=*) docdir="$optarg"
> ;;
> --sysconfdir=*) sysconfdir="$optarg"
> ;;
> @@ -5770,7 +5770,6 @@ fi
> qemu_confdir="$sysconfdir/$qemu_suffix"
> qemu_moddir="$libdir/$qemu_suffix"
> qemu_datadir="$datadir/$qemu_suffix"
> -qemu_docdir="$docdir/$qemu_suffix"
> qemu_localedir="$datadir/locale"
> qemu_icondir="$datadir/icons"
> qemu_desktopdir="$datadir/applications"
> --
> 2.28.0.windows.1
>
>
[-- Attachment #2: Type: text/html, Size: 1520 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
2020-10-15 21:22 ` Paolo Bonzini
@ 2020-10-15 21:33 ` 罗勇刚(Yonggang Luo)
0 siblings, 0 replies; 13+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-10-15 21:33 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Peter Maydell, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 3520 bytes --]
It's tests, running by make
On Fri, Oct 16, 2020 at 5:23 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
>
> Il gio 15 ott 2020, 22:30 Peter Maydell <peter.maydell@linaro.org> ha
scritto:
>>
>> On Thu, 15 Oct 2020 at 21:13, Yonggang Luo <luoyonggang@gmail.com> wrote:
>> >
>> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
>> > ---
>> > docs/conf.py | 2 +-
>> > docs/sphinx/kerneldoc.py | 2 +-
>> > scripts/rst-sanitize.py | 21 +++++++++++++++++++++
>> > tests/qapi-schema/meson.build | 5 +++--
>> > 4 files changed, 26 insertions(+), 4 deletions(-)
>> > create mode 100644 scripts/rst-sanitize.py
>> >
>> > diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
>> > new file mode 100644
>> > index 0000000000..26060f1208
>> > --- /dev/null
>> > +++ b/scripts/rst-sanitize.py
>> > @@ -0,0 +1,21 @@
>> > +#!/usr/bin/env python3
>> > +
>> > +#
>> > +# Script for remove cr line ending in file
>> > +#
>> > +# Authors:
>> > +# Yonggang Luo <luoyonggang@gmail.com>
>> > +#
>> > +# This work is licensed under the terms of the GNU GPL, version 2
>> > +# or, at your option, any later version. See the COPYING file in
>> > +# the top-level directory.
>> > +
>> > +import sys
>> > +
>> > +def main(_program, file, *unused):
>> > + with open(file, 'rb') as content_file:
>> > + content = content_file.read()
>> > + sys.stdout.buffer.write(content.replace(b'\r', b''))
>> > +
>> > +if __name__ == "__main__":
>> > + main(*sys.argv)
>>
>> Why doesn't the perl rune work? Your commit message doesn't say.
>
>
> Ninjatool gets confused by Windows escapes. So it's a QEMU-ism and
switching to ninja fixes it. There's no need to use a separate script for
this.
>
> Paolo
>
>>
>> > diff --git a/tests/qapi-schema/meson.build
b/tests/qapi-schema/meson.build
>> > index 1f222a7a13..20a7641af8 100644
>> > --- a/tests/qapi-schema/meson.build
>> > +++ b/tests/qapi-schema/meson.build
>> > @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
>> > # using an explicit '\' character in the command arguments to
>> > # a custom_target(), as Meson will unhelpfully replace it with a '/'
>> > # (https://github.com/mesonbuild/meson/issues/1564)
>> > +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'),
'@INPUT@']
>> > qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
>> > output: ['doc-good.txt.nocr'],
>> > input: qapi_doc_out[0],
>> > build_by_default: build_docs,
>> > - command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
>> > + command: rst_sanitize_cmd,
>> > capture: true)
>> >
>> > qapi_doc_ref_nocr = custom_target('QAPI rST doc reference
newline-sanitized',
>> > output: ['doc-good.ref.nocr'],
>> > input: files('doc-good.txt'),
>> > build_by_default: build_docs,
>> > - command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
>> > + command: rst_sanitize_cmd,
>> > capture: true)
>>
>> thanks
>> -- PMM
>>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 5116 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/4] configure: the docdir option should passed to meson as is.
2020-10-15 21:23 ` Paolo Bonzini
@ 2020-10-15 21:39 ` 罗勇刚(Yonggang Luo)
0 siblings, 0 replies; 13+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-10-15 21:39 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]
Grep qemu_docdir and docdir in configure, you will know why, qemu_docdir
not used at all in configure,
On Fri, Oct 16, 2020 at 5:24 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Why?
>
> Paolo
>
> Il gio 15 ott 2020, 22:11 Yonggang Luo <luoyonggang@gmail.com> ha scritto:
>>
>> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
>> ---
>> configure | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index f839c2a557..1ce31f97b4 100755
>> --- a/configure
>> +++ b/configure
>> @@ -971,7 +971,7 @@ for opt do
>> ;;
>> --with-suffix=*) qemu_suffix="$optarg"
>> ;;
>> - --docdir=*) qemu_docdir="$optarg"
>> + --docdir=*) docdir="$optarg"
>> ;;
>> --sysconfdir=*) sysconfdir="$optarg"
>> ;;
>> @@ -5770,7 +5770,6 @@ fi
>> qemu_confdir="$sysconfdir/$qemu_suffix"
>> qemu_moddir="$libdir/$qemu_suffix"
>> qemu_datadir="$datadir/$qemu_suffix"
>> -qemu_docdir="$docdir/$qemu_suffix"
>> qemu_localedir="$datadir/locale"
>> qemu_icondir="$datadir/icons"
>> qemu_desktopdir="$datadir/applications"
>> --
>> 2.28.0.windows.1
>>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 1834 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/4] Fixes docs building on msys2/mingw
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
` (3 preceding siblings ...)
2020-10-15 20:10 ` [PATCH v2 4/4] cirrus: Enable doc build on msys2/mingw Yonggang Luo
@ 2020-10-15 21:52 ` Paolo Bonzini
2020-10-15 21:55 ` 罗勇刚(Yonggang Luo)
4 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2020-10-15 21:52 UTC (permalink / raw)
To: Yonggang Luo; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
Looks good, apart from the CR removal patch that can simply be dropped.
Paolo
Il gio 15 ott 2020, 22:10 Yonggang Luo <luoyonggang@gmail.com> ha scritto:
> v1 - v2
> Also move the docs configure part from
> configure to meson, this also fixed the pending
> ninjatool removal caused issue that docs can
> not be build under msys2/mingw
>
> Yonggang Luo (4):
> docs: Fixes build docs on msys2/mingw
> configure: the docdir option should passed to meson as is.
> meson: Move the detection logic for sphinx to meson
> cirrus: Enable doc build on msys2/mingw
>
> .cirrus.yml | 6 +++-
> configure | 62 +++--------------------------------
> docs/conf.py | 2 +-
> docs/meson.build | 4 +--
> docs/sphinx/kerneldoc.py | 2 +-
> meson.build | 59 +++++++++++++++++++++++++++++----
> meson_options.txt | 5 ++-
> scripts/rst-sanitize.py | 21 ++++++++++++
> tests/qapi-schema/meson.build | 7 ++--
> 9 files changed, 95 insertions(+), 73 deletions(-)
> create mode 100644 scripts/rst-sanitize.py
>
> --
> 2.28.0.windows.1
>
>
>
[-- Attachment #2: Type: text/html, Size: 1628 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/4] Fixes docs building on msys2/mingw
2020-10-15 21:52 ` [PATCH v2 0/4] Fixes docs building " Paolo Bonzini
@ 2020-10-15 21:55 ` 罗勇刚(Yonggang Luo)
0 siblings, 0 replies; 13+ messages in thread
From: 罗勇刚(Yonggang Luo) @ 2020-10-15 21:55 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1438 bytes --]
On Fri, Oct 16, 2020 at 5:53 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Looks good, apart from the CR removal patch that can simply be dropped.
Resend with fixes, the CR removal patch composite two part.
>
> Paolo
>
> Il gio 15 ott 2020, 22:10 Yonggang Luo <luoyonggang@gmail.com> ha scritto:
>>
>> v1 - v2
>> Also move the docs configure part from
>> configure to meson, this also fixed the pending
>> ninjatool removal caused issue that docs can
>> not be build under msys2/mingw
>>
>> Yonggang Luo (4):
>> docs: Fixes build docs on msys2/mingw
>> configure: the docdir option should passed to meson as is.
>> meson: Move the detection logic for sphinx to meson
>> cirrus: Enable doc build on msys2/mingw
>>
>> .cirrus.yml | 6 +++-
>> configure | 62 +++--------------------------------
>> docs/conf.py | 2 +-
>> docs/meson.build | 4 +--
>> docs/sphinx/kerneldoc.py | 2 +-
>> meson.build | 59 +++++++++++++++++++++++++++++----
>> meson_options.txt | 5 ++-
>> scripts/rst-sanitize.py | 21 ++++++++++++
>> tests/qapi-schema/meson.build | 7 ++--
>> 9 files changed, 95 insertions(+), 73 deletions(-)
>> create mode 100644 scripts/rst-sanitize.py
>>
>> --
>> 2.28.0.windows.1
>>
>>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 1946 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-10-15 21:58 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 20:10 [PATCH v2 0/4] Fixes docs building on msys2/mingw Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 1/4] docs: Fixes build docs " Yonggang Luo
2020-10-15 20:30 ` Peter Maydell
2020-10-15 20:38 ` 罗勇刚(Yonggang Luo)
2020-10-15 21:22 ` Paolo Bonzini
2020-10-15 21:33 ` 罗勇刚(Yonggang Luo)
2020-10-15 20:10 ` [PATCH v2 2/4] configure: the docdir option should passed to meson as is Yonggang Luo
2020-10-15 21:23 ` Paolo Bonzini
2020-10-15 21:39 ` 罗勇刚(Yonggang Luo)
2020-10-15 20:10 ` [PATCH v2 3/4] meson: Move the detection logic for sphinx to meson Yonggang Luo
2020-10-15 20:10 ` [PATCH v2 4/4] cirrus: Enable doc build on msys2/mingw Yonggang Luo
2020-10-15 21:52 ` [PATCH v2 0/4] Fixes docs building " Paolo Bonzini
2020-10-15 21:55 ` 罗勇刚(Yonggang Luo)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).