2019-06-07 15:51:33

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

From: Jonathan Corbet <[email protected]>

commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream.

AutoReporter is going away; recent versions of sphinx emit a warning like:

Documentation/sphinx/kerneldoc.py:125:
RemovedInSphinx20Warning: AutodocReporter is now deprecated.
Use sphinx.util.docutils.switch_source_input() instead.

Make the switch. But switch_source_input() only showed up in 1.7, so we
have to do ugly version checks to keep things working in older versions.

Cc: [email protected]
Signed-off-by: Jonathan Corbet <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
Documentation/sphinx/kerneldoc.py | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)

--- a/Documentation/sphinx/kerneldoc.py
+++ b/Documentation/sphinx/kerneldoc.py
@@ -37,7 +37,17 @@ import glob
from docutils import nodes, statemachine
from docutils.statemachine import ViewList
from docutils.parsers.rst import directives, Directive
-from sphinx.ext.autodoc import AutodocReporter
+
+#
+# AutodocReporter is only good up to Sphinx 1.7
+#
+import sphinx
+
+Use_SSI = sphinx.__version__[:3] >= '1.7'
+if Use_SSI:
+ from sphinx.util.docutils import switch_source_input
+else:
+ from sphinx.ext.autodoc import AutodocReporter

__version__ = '1.0'

@@ -121,13 +131,7 @@ class KernelDocDirective(Directive):
lineoffset += 1

node = nodes.section()
- buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
- self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
- self.state.memo.title_styles, self.state.memo.section_level = [], 0
- try:
- self.state.nested_parse(result, 0, node, match_titles=1)
- finally:
- self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf
+ self.do_parse(result, node)

return node.children

@@ -136,6 +140,20 @@ class KernelDocDirective(Directive):
(" ".join(cmd), str(e)))
return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]

+ def do_parse(self, result, node):
+ if Use_SSI:
+ with switch_source_input(self.state, result):
+ self.state.nested_parse(result, 0, node, match_titles=1)
+ else:
+ save = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
+ self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
+ self.state.memo.title_styles, self.state.memo.section_level = [], 0
+ try:
+ self.state.nested_parse(result, 0, node, match_titles=1)
+ finally:
+ self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = save
+
+
def setup(app):
app.add_config_value('kerneldoc_bin', None, 'env')
app.add_config_value('kerneldoc_srctree', None, 'env')



2019-06-10 06:29:04

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On 07. 06. 19, 17:39, Greg Kroah-Hartman wrote:
> From: Jonathan Corbet <[email protected]>
>
> commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream.
>
> AutoReporter is going away; recent versions of sphinx emit a warning like:
>
> Documentation/sphinx/kerneldoc.py:125:
> RemovedInSphinx20Warning: AutodocReporter is now deprecated.
> Use sphinx.util.docutils.switch_source_input() instead.
>
> Make the switch. But switch_source_input() only showed up in 1.7, so we
> have to do ugly version checks to keep things working in older versions.

Hi,

this patch breaks our build of kernel-docs on 5.1.*:
https://build.opensuse.org/package/live_build_log/Kernel:stable/kernel-docs/standard/x86_64

The error is:
[ 250s] reST markup error:
[ 250s]
/home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/Documentation/gpu/i915.rst:403:
(SEVERE/4) Title level inconsistent:
[ 250s]
[ 250s] Global GTT Fence Handling
[ 250s] ~~~~~~~~~~~~~~~~~~~~~~~~~

Reverting the patch from 5.1.* makes it work again.

5.2-rc3 (includes the patch) is OK:
https://build.opensuse.org/package/live_build_log/Kernel:HEAD/kernel-docs/standard/x86_64

So 5.1.* must be missing something now.

> Cc: [email protected]
> Signed-off-by: Jonathan Corbet <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> ---
> Documentation/sphinx/kerneldoc.py | 34 ++++++++++++++++++++++++++--------
> 1 file changed, 26 insertions(+), 8 deletions(-)
>
> --- a/Documentation/sphinx/kerneldoc.py
> +++ b/Documentation/sphinx/kerneldoc.py
> @@ -37,7 +37,17 @@ import glob
> from docutils import nodes, statemachine
> from docutils.statemachine import ViewList
> from docutils.parsers.rst import directives, Directive
> -from sphinx.ext.autodoc import AutodocReporter
> +
> +#
> +# AutodocReporter is only good up to Sphinx 1.7
> +#
> +import sphinx
> +
> +Use_SSI = sphinx.__version__[:3] >= '1.7'
> +if Use_SSI:
> + from sphinx.util.docutils import switch_source_input
> +else:
> + from sphinx.ext.autodoc import AutodocReporter
>
> __version__ = '1.0'

thanks,
--
js
suse labs

2019-06-10 07:33:12

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On Mon, Jun 10, 2019 at 08:27:30AM +0200, Jiri Slaby wrote:
> On 07. 06. 19, 17:39, Greg Kroah-Hartman wrote:
> > From: Jonathan Corbet <[email protected]>
> >
> > commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream.
> >
> > AutoReporter is going away; recent versions of sphinx emit a warning like:
> >
> > Documentation/sphinx/kerneldoc.py:125:
> > RemovedInSphinx20Warning: AutodocReporter is now deprecated.
> > Use sphinx.util.docutils.switch_source_input() instead.
> >
> > Make the switch. But switch_source_input() only showed up in 1.7, so we
> > have to do ugly version checks to keep things working in older versions.
>
> Hi,
>
> this patch breaks our build of kernel-docs on 5.1.*:
> https://build.opensuse.org/package/live_build_log/Kernel:stable/kernel-docs/standard/x86_64
>
> The error is:
> [ 250s] reST markup error:
> [ 250s]
> /home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/Documentation/gpu/i915.rst:403:
> (SEVERE/4) Title level inconsistent:
> [ 250s]
> [ 250s] Global GTT Fence Handling
> [ 250s] ~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Reverting the patch from 5.1.* makes it work again.
>
> 5.2-rc3 (includes the patch) is OK:
> https://build.opensuse.org/package/live_build_log/Kernel:HEAD/kernel-docs/standard/x86_64
>
> So 5.1.* must be missing something now.

Odd. running 'make htmldocs' on 5.1 with these patches applied works
for me here.

What version of sphinx are you using to build the package with?

thanks,

greg k-h

2019-06-10 07:36:36

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On 10. 06. 19, 9:31, Greg Kroah-Hartman wrote:
> On Mon, Jun 10, 2019 at 08:27:30AM +0200, Jiri Slaby wrote:
>> On 07. 06. 19, 17:39, Greg Kroah-Hartman wrote:
>>> From: Jonathan Corbet <[email protected]>
>>>
>>> commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream.
>>>
>>> AutoReporter is going away; recent versions of sphinx emit a warning like:
>>>
>>> Documentation/sphinx/kerneldoc.py:125:
>>> RemovedInSphinx20Warning: AutodocReporter is now deprecated.
>>> Use sphinx.util.docutils.switch_source_input() instead.
>>>
>>> Make the switch. But switch_source_input() only showed up in 1.7, so we
>>> have to do ugly version checks to keep things working in older versions.
>>
>> Hi,
>>
>> this patch breaks our build of kernel-docs on 5.1.*:
>> https://build.opensuse.org/package/live_build_log/Kernel:stable/kernel-docs/standard/x86_64
>>
>> The error is:
>> [ 250s] reST markup error:
>> [ 250s]
>> /home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/Documentation/gpu/i915.rst:403:
>> (SEVERE/4) Title level inconsistent:
>> [ 250s]
>> [ 250s] Global GTT Fence Handling
>> [ 250s] ~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Reverting the patch from 5.1.* makes it work again.
>>
>> 5.2-rc3 (includes the patch) is OK:
>> https://build.opensuse.org/package/live_build_log/Kernel:HEAD/kernel-docs/standard/x86_64
>>
>> So 5.1.* must be missing something now.
>
> Odd. running 'make htmldocs' on 5.1 with these patches applied works
> for me here.
>
> What version of sphinx are you using to build the package with?

From the log, it looks like 1.8.5 (it's tumbleweed):

$ osc rbl Kernel:stable/kernel-docs/standard/x86_64|grep -i sphinx
[ 11s] cycle: python3-sphinx_rtd_theme -> python3-Sphinx
[ 11s] breaking dependency python3-Sphinx -> python3-sphinx_rtd_theme
[ 32s] [226/263] cumulate python3-sphinxcontrib-websupport-1.1.0-1.2
[ 32s] [239/263] cumulate python3-Sphinx-1.8.5-2.2
[ 32s] [242/263] cumulate python3-sphinx_rtd_theme-0.4.1-1.3
[ 72s]
python3-sphinxcontrib-websupport-1.1.0########################################
[ 72s] python3-sphinx_rtd_theme-0.4.1-1.3
########################################
[ 73s] python3-Sphinx-1.8.5-2.2
########################################
[ 73s] update-alternatives: using /usr/bin/sphinx-apidoc-3.7 to
provide /usr/bin/sphinx-apidoc (sphinx-apidoc) in auto mode
[ 101s] + patch -s -F0 -E -p1 --no-backup-if-mismatch -i
/home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/patches.kernel.org/5.1.8-055-docs-Fix-conf.py-for-Sphin-2.0.patch
[ 101s] + patch -s -F0 -E -p1 --no-backup-if-mismatch -i
/home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/patches.kernel.org/5.1.8-057-doc-Cope-with-Sphinx-logging-deprecations.patch
[ 102s] SPHINX htmldocs -->
file:///home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/html/Documentation/output
[ 103s] Running Sphinx v1.8.5

thanks,
--
js
suse labs

2019-06-10 07:49:31

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On Mon, Jun 10, 2019 at 09:34:10AM +0200, Jiri Slaby wrote:
> On 10. 06. 19, 9:31, Greg Kroah-Hartman wrote:
> > On Mon, Jun 10, 2019 at 08:27:30AM +0200, Jiri Slaby wrote:
> >> On 07. 06. 19, 17:39, Greg Kroah-Hartman wrote:
> >>> From: Jonathan Corbet <[email protected]>
> >>>
> >>> commit 2404dad1f67f8917e30fc22a85e0dbcc85b99955 upstream.
> >>>
> >>> AutoReporter is going away; recent versions of sphinx emit a warning like:
> >>>
> >>> Documentation/sphinx/kerneldoc.py:125:
> >>> RemovedInSphinx20Warning: AutodocReporter is now deprecated.
> >>> Use sphinx.util.docutils.switch_source_input() instead.
> >>>
> >>> Make the switch. But switch_source_input() only showed up in 1.7, so we
> >>> have to do ugly version checks to keep things working in older versions.
> >>
> >> Hi,
> >>
> >> this patch breaks our build of kernel-docs on 5.1.*:
> >> https://build.opensuse.org/package/live_build_log/Kernel:stable/kernel-docs/standard/x86_64
> >>
> >> The error is:
> >> [ 250s] reST markup error:
> >> [ 250s]
> >> /home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/Documentation/gpu/i915.rst:403:
> >> (SEVERE/4) Title level inconsistent:
> >> [ 250s]
> >> [ 250s] Global GTT Fence Handling
> >> [ 250s] ~~~~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> Reverting the patch from 5.1.* makes it work again.
> >>
> >> 5.2-rc3 (includes the patch) is OK:
> >> https://build.opensuse.org/package/live_build_log/Kernel:HEAD/kernel-docs/standard/x86_64
> >>
> >> So 5.1.* must be missing something now.
> >
> > Odd. running 'make htmldocs' on 5.1 with these patches applied works
> > for me here.
> >
> > What version of sphinx are you using to build the package with?
>
> >From the log, it looks like 1.8.5 (it's tumbleweed):
>
> $ osc rbl Kernel:stable/kernel-docs/standard/x86_64|grep -i sphinx
> [ 11s] cycle: python3-sphinx_rtd_theme -> python3-Sphinx
> [ 11s] breaking dependency python3-Sphinx -> python3-sphinx_rtd_theme
> [ 32s] [226/263] cumulate python3-sphinxcontrib-websupport-1.1.0-1.2
> [ 32s] [239/263] cumulate python3-Sphinx-1.8.5-2.2
> [ 32s] [242/263] cumulate python3-sphinx_rtd_theme-0.4.1-1.3
> [ 72s]
> python3-sphinxcontrib-websupport-1.1.0########################################
> [ 72s] python3-sphinx_rtd_theme-0.4.1-1.3
> ########################################
> [ 73s] python3-Sphinx-1.8.5-2.2
> ########################################
> [ 73s] update-alternatives: using /usr/bin/sphinx-apidoc-3.7 to
> provide /usr/bin/sphinx-apidoc (sphinx-apidoc) in auto mode
> [ 101s] + patch -s -F0 -E -p1 --no-backup-if-mismatch -i
> /home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/patches.kernel.org/5.1.8-055-docs-Fix-conf.py-for-Sphin-2.0.patch
> [ 101s] + patch -s -F0 -E -p1 --no-backup-if-mismatch -i
> /home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/patches.kernel.org/5.1.8-057-doc-Cope-with-Sphinx-logging-deprecations.patch
> [ 102s] SPHINX htmldocs -->
> file:///home/abuild/rpmbuild/BUILD/kernel-docs-5.1.8/linux-5.1/html/Documentation/output
> [ 103s] Running Sphinx v1.8.5

Hm, 2.1 here:
Running Sphinx v2.1.0
perhaps Tumbleweed needs to update? :)

Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
just drop these changes.

thanks,

greg k-h

2019-06-10 07:58:14

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On 10. 06. 19, 9:48, Greg Kroah-Hartman wrote:
>> [ 103s] Running Sphinx v1.8.5
>
> Hm, 2.1 here:
> Running Sphinx v2.1.0
> perhaps Tumbleweed needs to update? :)

Heh, it was submitted 3 days ago :):
https://build.opensuse.org/request/show/708276
(And is blocked by a failing sphinx-test AFAICT.)

> Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
> just drop these changes.

OK. In the meantime, I have reverted the commit in Kernel:stable for the
time being.

thanks,
--
js
suse labs

2019-06-10 13:02:29

by Jonathan Corbet

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On Mon, 10 Jun 2019 09:48:40 +0200
Greg Kroah-Hartman <[email protected]> wrote:

> Hm, 2.1 here:
> Running Sphinx v2.1.0
> perhaps Tumbleweed needs to update? :)

Heh...trying 2.1 is still on my list of things to do ... :)

> Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
> just drop these changes.

The fix for that is 551bd3368a7b (drm/i915: Maintain consistent
documentation subsection ordering) which was also marked for stable. Jiri,
do you somehow not have that one?

Thanks,

jon

2019-06-10 14:07:32

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On Mon, Jun 10, 2019 at 06:33:40AM -0600, Jonathan Corbet wrote:
> On Mon, 10 Jun 2019 09:48:40 +0200
> Greg Kroah-Hartman <[email protected]> wrote:
>
> > Hm, 2.1 here:
> > Running Sphinx v2.1.0
> > perhaps Tumbleweed needs to update? :)
>
> Heh...trying 2.1 is still on my list of things to do ... :)
>
> > Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
> > just drop these changes.
>
> The fix for that is 551bd3368a7b (drm/i915: Maintain consistent
> documentation subsection ordering) which was also marked for stable. Jiri,
> do you somehow not have that one?

It's part of this series, which is probably why it works for me. Don't
know why it doesn't work for Jiri, unless he is cherry-picking things?

thanks,

greg k-h

2019-06-10 16:05:26

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On Mon, Jun 10, 2019 at 05:27:39PM +0300, Thomas Backlund wrote:
> Den 10-06-2019 kl. 17:05, skrev Greg Kroah-Hartman:
> > On Mon, Jun 10, 2019 at 06:33:40AM -0600, Jonathan Corbet wrote:
> > > On Mon, 10 Jun 2019 09:48:40 +0200
> > > Greg Kroah-Hartman <[email protected]> wrote:
> > >
> > > > Hm, 2.1 here:
> > > > Running Sphinx v2.1.0
> > > > perhaps Tumbleweed needs to update? :)
> > >
> > > Heh...trying 2.1 is still on my list of things to do ... :)
> > >
> > > > Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
> > > > just drop these changes.
> > >
> > > The fix for that is 551bd3368a7b (drm/i915: Maintain consistent
> > > documentation subsection ordering) which was also marked for stable. Jiri,
> > > do you somehow not have that one?
> >
> > It's part of this series, which is probably why it works for me. Don't
> > know why it doesn't work for Jiri, unless he is cherry-picking things?
> >
>
> Actualliy it is not.
>
> This patch Jiri responded to / points out to break stuff is part of 5.1.8,
> but the fix in in review queue for 5.1.9 :
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/diff/queue-5.1/drm-i915-maintain-consistent-documentation-subsection-ordering.patch?id=29167bff7a1c0d79dda104c44c262b0bc4cd6644

Ah, that makes more sense, and is why my build works for me :)

Jiri, wait a few days and this will get fixed...

thanks,

greg k-h

2019-06-10 16:06:49

by Thomas Backlund

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

Den 10-06-2019 kl. 17:05, skrev Greg Kroah-Hartman:
> On Mon, Jun 10, 2019 at 06:33:40AM -0600, Jonathan Corbet wrote:
>> On Mon, 10 Jun 2019 09:48:40 +0200
>> Greg Kroah-Hartman <[email protected]> wrote:
>>
>>> Hm, 2.1 here:
>>> Running Sphinx v2.1.0
>>> perhaps Tumbleweed needs to update? :)
>>
>> Heh...trying 2.1 is still on my list of things to do ... :)
>>
>>> Anyway, this should not be breaking, if Jon doesn't have any ideas, I'll
>>> just drop these changes.
>>
>> The fix for that is 551bd3368a7b (drm/i915: Maintain consistent
>> documentation subsection ordering) which was also marked for stable. Jiri,
>> do you somehow not have that one?
>
> It's part of this series, which is probably why it works for me. Don't
> know why it doesn't work for Jiri, unless he is cherry-picking things?
>

Actualliy it is not.

This patch Jiri responded to / points out to break stuff is part of
5.1.8, but the fix in in review queue for 5.1.9 :

https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/diff/queue-5.1/drm-i915-maintain-consistent-documentation-subsection-ordering.patch?id=29167bff7a1c0d79dda104c44c262b0bc4cd6644

--
Thomas

2019-06-11 08:52:23

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 5.1 56/85] doc: Cope with the deprecation of AutoReporter

On 10. 06. 19, 16:39, Greg Kroah-Hartman wrote:
>>>> The fix for that is 551bd3368a7b (drm/i915: Maintain consistent
>>>> documentation subsection ordering) which was also marked for stable. Jiri,
>>>> do you somehow not have that one?
>>>
>>> It's part of this series, which is probably why it works for me. Don't
>>> know why it doesn't work for Jiri, unless he is cherry-picking things?
>>>
>>
>> Actualliy it is not.
>>
>> This patch Jiri responded to / points out to break stuff is part of 5.1.8,
>> but the fix in in review queue for 5.1.9 :
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/diff/queue-5.1/drm-i915-maintain-consistent-documentation-subsection-ordering.patch?id=29167bff7a1c0d79dda104c44c262b0bc4cd6644
>
> Ah, that makes more sense, and is why my build works for me :)
>
> Jiri, wait a few days and this will get fixed...

No problem. I just pushed this one and 5.1.9 will dispose it later.

thanks,
--
js
suse labs