SHA256
1
0
forked from pool/bind
bind/bind-fix-build-with-older-sphinx.patch
Marcus Meissner 2d1a8b1c56 Accepting request 901768 from home:frispete:15.2
Hi,

here's an attempt to build the current bind with SLES/LEAP.
I tried to come up with something mode decent (replacement of 
sphinx.util.docutils.ReferenceRole), but run out of time.
With these admittedly ugly fixes, bind does build at least, 
including the ARM, but that is missing the clickable issues
in the version specific notes and being redirected to GitLab.

- Add patch bind-fix-build-with-older-sphinx.patch and sed fix
  in order to build with older distributions.

OBS-URL: https://build.opensuse.org/request/show/901768
OBS-URL: https://build.opensuse.org/package/show/network/bind?expand=0&rev=324
2021-06-28 07:10:05 +00:00

109 lines
4.2 KiB
Diff

Index: b/doc/arm/conf.py
===================================================================
--- a/doc/arm/conf.py
+++ b/doc/arm/conf.py
@@ -18,54 +18,58 @@ from docutils.nodes import Node, system_
from docutils.parsers.rst import roles
from sphinx import addnodes
-from sphinx.util.docutils import ReferenceRole
+try:
+ from sphinx.util.docutils import ReferenceRole
+ GITLAB_BASE_URL = 'https://gitlab.isc.org/isc-projects/bind9/-/'
-GITLAB_BASE_URL = 'https://gitlab.isc.org/isc-projects/bind9/-/'
-
-# Custom Sphinx role enabling automatic hyperlinking to GitLab issues/MRs.
-class GitLabRefRole(ReferenceRole):
- def __init__(self, base_url: str) -> None:
- self.base_url = base_url
- super().__init__()
-
- def run(self) -> Tuple[List[Node], List[system_message]]:
- gl_identifier = '[GL %s]' % self.target
-
- target_id = 'index-%s' % self.env.new_serialno('index')
- entries = [('single', 'GitLab; ' + gl_identifier, target_id, '', None)]
-
- index = addnodes.index(entries=entries)
- target = nodes.target('', '', ids=[target_id])
- self.inliner.document.note_explicit_target(target)
-
- try:
- refuri = self.build_uri()
- reference = nodes.reference('', '', internal=False, refuri=refuri,
- classes=['gl'])
- if self.has_explicit_title:
- reference += nodes.strong(self.title, self.title)
- else:
- reference += nodes.strong(gl_identifier, gl_identifier)
- except ValueError:
- error_text = 'invalid GitLab identifier %s' % self.target
- msg = self.inliner.reporter.error(error_text, line=self.lineno)
- prb = self.inliner.problematic(self.rawtext, self.rawtext, msg)
- return [prb], [msg]
-
- return [index, target, reference], []
-
- def build_uri(self):
- if self.target[0] == '#':
- return self.base_url + 'issues/%d' % int(self.target[1:])
- if self.target[0] == '!':
- return self.base_url + 'merge_requests/%d' % int(self.target[1:])
- raise ValueError
-
-
-def setup(_):
- roles.register_local_role('gl', GitLabRefRole(GITLAB_BASE_URL))
+ # Custom Sphinx role enabling automatic hyperlinking to GitLab issues/MRs.
+ class GitLabRefRole(ReferenceRole):
+ def __init__(self, base_url: str) -> None:
+ self.base_url = base_url
+ super().__init__()
+
+ def run(self) -> Tuple[List[Node], List[system_message]]:
+ gl_identifier = '[GL %s]' % self.target
+
+ target_id = 'index-%s' % self.env.new_serialno('index')
+ entries = [('single', 'GitLab; ' + gl_identifier, target_id, '', None)]
+
+ index = addnodes.index(entries=entries)
+ target = nodes.target('', '', ids=[target_id])
+ self.inliner.document.note_explicit_target(target)
+
+ try:
+ refuri = self.build_uri()
+ reference = nodes.reference('', '', internal=False, refuri=refuri,
+ classes=['gl'])
+ if self.has_explicit_title:
+ reference += nodes.strong(self.title, self.title)
+ else:
+ reference += nodes.strong(gl_identifier, gl_identifier)
+ except ValueError:
+ error_text = 'invalid GitLab identifier %s' % self.target
+ msg = self.inliner.reporter.error(error_text, line=self.lineno)
+ prb = self.inliner.problematic(self.rawtext, self.rawtext, msg)
+ return [prb], [msg]
+
+ return [index, target, reference], []
+
+ def build_uri(self):
+ if self.target[0] == '#':
+ return self.base_url + 'issues/%d' % int(self.target[1:])
+ if self.target[0] == '!':
+ return self.base_url + 'merge_requests/%d' % int(self.target[1:])
+ raise ValueError
+
+
+ def setup(_):
+ roles.register_local_role('gl', GitLabRefRole(GITLAB_BASE_URL))
+
+except ImportError:
+ # better loose this feature, than failing the build
+ pass
#
# Configuration file for the Sphinx documentation builder.