From 867f0902930e1bd3aabb8c8816f7fde95f184335 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 11 Sep 2020 16:21:45 +0200 Subject: [PATCH] gtk-doc: add patches from debian, remove noarch This contains backports so that new glib can generate docs with it. --- ...-Please-make-the-output-reproducible.patch | 51 ++++++++++ ...kdb-ensure-deterministic-index-files.patch | 22 +++++ ...BEGIN-END-_IGNORE_DEPRECATIONS-lines.patch | 28 ++++++ ...typedef-can-be-followed-by-decorator.patch | 57 +++++++++++ ...an-support-deprecated-struct-members.patch | 86 ++++++++++++++++ ...tree-structure-without-using-anytree.patch | 98 +++++++++++++++++++ .../patches/0007-revert_fix_build.patch | 25 +++++ ...-hack.patch => 0008-pkg-config-hack.patch} | 4 +- srcpkgs/gtk-doc/template | 4 +- 9 files changed, 371 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/gtk-doc/patches/0001-Please-make-the-output-reproducible.patch create mode 100644 srcpkgs/gtk-doc/patches/0002-mkdb-ensure-deterministic-index-files.patch create mode 100644 srcpkgs/gtk-doc/patches/0003-Skip-G_GNUC_-BEGIN-END-_IGNORE_DEPRECATIONS-lines.patch create mode 100644 srcpkgs/gtk-doc/patches/0004-typedef-can-be-followed-by-decorator.patch create mode 100644 srcpkgs/gtk-doc/patches/0005-scan-support-deprecated-struct-members.patch create mode 100644 srcpkgs/gtk-doc/patches/0006-Implement-a-simple-tree-structure-without-using-anytree.patch create mode 100644 srcpkgs/gtk-doc/patches/0007-revert_fix_build.patch rename srcpkgs/gtk-doc/patches/{pkg-config-hack.patch => 0008-pkg-config-hack.patch} (60%) diff --git a/srcpkgs/gtk-doc/patches/0001-Please-make-the-output-reproducible.patch b/srcpkgs/gtk-doc/patches/0001-Please-make-the-output-reproducible.patch new file mode 100644 index 0000000000..e687a5a48b --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0001-Please-make-the-output-reproducible.patch @@ -0,0 +1,51 @@ +From: Chris Lamb +Date: Sat, 7 Dec 2019 13:56:24 +0000 +Subject: Please make the output reproducible +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Whilst working on the Reproducible Builds effort [0] we noticed that +gtk-doc generates unreproducible output. + +There will likely be more issues but this one is at least fairly +simple in that it iterates over a set structure when printing +some .devhelp2 headers, for example: + +│ │ │ │ - +│ │ │ │ - +│ │ │ │ +│ │ │ │ - +│ │ │ │ + +│ │ │ │ +│ │ │ │ + +│ │ │ │ +│ │ │ │ - +│ │ │ │ +│ │ │ │ + +│ │ │ │ + + +This was originally filed in Debian as #946311 [1]. + + [0] https://reproducible-builds.org/ + [1] https://bugs.debian.org/946331 + +Signed-off-by: Chris Lamb +Origin: upstream, commit: 06eda7ca8fa42c654fd2ad861c1c43c1b395bc57 +--- + gtkdoc/mkdb.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index bcb5423..087ede2 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -2491,7 +2491,7 @@ def OutputBook(main_file, book_top, book_bottom, obj_tree): + + + ''') +- for version in set(Since.values()): ++ for version in sorted(set(Since.values())): + dash_version = version.replace('.', '-') + OUTPUT.write(''' + Index of new API in %s diff --git a/srcpkgs/gtk-doc/patches/0002-mkdb-ensure-deterministic-index-files.patch b/srcpkgs/gtk-doc/patches/0002-mkdb-ensure-deterministic-index-files.patch new file mode 100644 index 0000000000..581ea5584f --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0002-mkdb-ensure-deterministic-index-files.patch @@ -0,0 +1,22 @@ +From: Stefan Sauer +Date: Mon, 23 Dec 2019 12:23:41 +0100 +Subject: mkdb: ensure deterministic index files. + +Origin: upstream, commit: 51762cfe2b47c886558ee5b311dca24bd5ddcd83 +--- + gtkdoc/mkdb.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index 087ede2..1e033d4 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -969,7 +969,7 @@ def OutputIndex(basename, apiindex): + + def OutputSinceIndexes(): + """Generate the 'since' api index files.""" +- for version in set(Since.values()): ++ for version in sorted(set(Since.values())): + logging.info("Since : [%s]", version) + index = {x: IndexEntriesSince[x] for x in IndexEntriesSince.keys() if Since[x] == version} + OutputIndex("api-index-" + version, index) diff --git a/srcpkgs/gtk-doc/patches/0003-Skip-G_GNUC_-BEGIN-END-_IGNORE_DEPRECATIONS-lines.patch b/srcpkgs/gtk-doc/patches/0003-Skip-G_GNUC_-BEGIN-END-_IGNORE_DEPRECATIONS-lines.patch new file mode 100644 index 0000000000..6877f97c3f --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0003-Skip-G_GNUC_-BEGIN-END-_IGNORE_DEPRECATIONS-lines.patch @@ -0,0 +1,28 @@ +From: Xavier Claessens +Date: Thu, 2 Jan 2020 21:56:10 -0500 +Subject: Skip G_GNUC_(BEGIN|END)_IGNORE_DEPRECATIONS lines + +For some reason, glib has to put empty line before and after each of +these lines otherwise the symbol following it is undeclared. + +Origin: upstream, commit:ca42972cd3fc5420a429ae752228c0c89ec7c763 +--- + gtkdoc/scan.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py +index d04d4d4..7de08ad 100644 +--- a/gtkdoc/scan.py ++++ b/gtkdoc/scan.py +@@ -561,6 +561,11 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options): + logging.info('Found start of comment: %s', line.strip()) + continue + ++ # Skip begin/end deprecation macros. ++ m = re.search(r'^\s*G_GNUC_(BEGIN|END)_IGNORE_DEPRECATIONS', line) ++ if m: ++ continue ++ + logging.info('no decl: %s', line.strip()) + + cm = [m.match(line) for m in CLINE_MATCHER] diff --git a/srcpkgs/gtk-doc/patches/0004-typedef-can-be-followed-by-decorator.patch b/srcpkgs/gtk-doc/patches/0004-typedef-can-be-followed-by-decorator.patch new file mode 100644 index 0000000000..08d20acdd1 --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0004-typedef-can-be-followed-by-decorator.patch @@ -0,0 +1,57 @@ +From: Xavier Claessens +Date: Fri, 3 Jan 2020 06:47:47 -0500 +Subject: typedef can be followed by decorator + +Origin: upstream, commit:b922e1486e6fa34611527f2628fef34ce4ffd42e +--- + gtkdoc/scan.py | 30 +++++++++++++++++------------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py +index 7de08ad..5a5da92 100644 +--- a/gtkdoc/scan.py ++++ b/gtkdoc/scan.py +@@ -96,19 +96,8 @@ CLINE_MATCHER = [ + (struct|union)\s* + \w*\s*{""", re.VERBOSE), + # 12-14: OTHER TYPEDEFS +- re.compile( +- r"""^\s*typedef\s+ +- (?:struct|union)\s+\w+[\s\*]+ +- (\w+) # 1: name +- \s*;""", re.VERBOSE), +- re.compile( +- r"""^\s* +- (?:G_GNUC_EXTENSION\s+)? +- typedef\s+ +- (.+[\s\*]) # 1: e.g. 'unsigned int' +- (\w+) # 2: name +- (?:\s*\[[^\]]+\])* +- \s*;""", re.VERBOSE), ++ None, # in InitScanner() ++ None, # in InitScanner() + re.compile(r'^\s*typedef\s+'), + # 15: VARIABLES (extern'ed variables) + None, # in InitScanner() +@@ -267,6 +256,21 @@ def InitScanner(options): + %s # 3: optional decorator + \s*;""" % optional_decorators_regex, re.VERBOSE) + # OTHER TYPEDEFS ++ CLINE_MATCHER[12] = re.compile( ++ r"""^\s*typedef\s+ ++ (?:struct|union)\s+\w+[\s\*]+ ++ (\w+) # 1: name ++ %s # 2: optional decorator ++ \s*;""" % optional_decorators_regex, re.VERBOSE) ++ CLINE_MATCHER[13] = re.compile( ++ r"""^\s* ++ (?:G_GNUC_EXTENSION\s+)? ++ typedef\s+ ++ (.+?[\s\*]) # 1: e.g. 'unsigned int' ++ (\w+) # 2: name ++ (?:\s*\[[^\]]+\])* ++ %s # 3: optional decorator ++ \s*;""" % optional_decorators_regex, re.VERBOSE) + CLINE_MATCHER[15] = re.compile( + r"""^\s* + (?:extern|[A-Za-z_]+VAR%s)\s+ diff --git a/srcpkgs/gtk-doc/patches/0005-scan-support-deprecated-struct-members.patch b/srcpkgs/gtk-doc/patches/0005-scan-support-deprecated-struct-members.patch new file mode 100644 index 0000000000..403e227af8 --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0005-scan-support-deprecated-struct-members.patch @@ -0,0 +1,86 @@ +From: Jason Crain +Date: Mon, 6 Jan 2020 19:05:42 -0700 +Subject: scan: support deprecated struct members + +gcc allows deprecating members of structs. For example: + +struct data { + int x G_GNUC_DEPRECATED_FOR(replacement); +}; + +However, this currently causes the entire struct to be marked as +deprecated and confuses mkdb because it doesn't understand the +G_GNUC_DEPRECATED_FOR symbol. + +Fix this by having the whole struct only be marked as deprecated if the +'_DEPRECATED' is after the closing bracket of the struct, similar to how +it already does for enums, and having scan automatically remove all +G_GNUC_* decorators from struct members, similar to how it already does +for functions. + +Origin: upstream, commit:b866a90b385d5eed12e123cfac0cf587f716c168 +--- + gtkdoc/scan.py | 12 ++++++++++-- + tests/scan.py | 17 +++++++++++++++++ + 2 files changed, 27 insertions(+), 2 deletions(-) + +diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py +index 5a5da92..6c6534a 100644 +--- a/gtkdoc/scan.py ++++ b/gtkdoc/scan.py +@@ -538,7 +538,7 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options): + # section (#endif /* XXX_DEPRECATED */ + if deprecated_conditional_nest == 0 and '_DEPRECATED' in line: + m = re.search(r'^\s*#\s*(if*|define|endif)', line) +- if not (m or in_declaration == 'enum'): ++ if not (m or in_declaration == 'enum' or in_declaration == 'struct'): + logging.info('Found deprecation annotation (decl: "%s"): "%s"', + in_declaration, line.strip()) + deprecated_conditional_nest += 0.1 +@@ -953,9 +953,17 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options): + title = '%s' % objectname + + logging.info('Store struct: "%s"', symbol) ++ # Structs could contain deprecated members and that doesn't ++ # mean the whole struct is deprecated, so they are ignored when ++ # setting deprecated_conditional_nest above. Here we can check ++ # if the _DEPRECATED is between '}' and ';' which would mean ++ # the struct as a whole is deprecated. ++ if re.search(r'\n\s*\}.*_DEPRECATED.*;\s*$', decl): ++ deprecated = '\n' + if AddSymbolToList(slist, symbol): + structsym = in_declaration.upper() +- stripped_decl = re.sub('(%s)' % optional_decorators_regex, '', decl) ++ regex = r'(?:\s+(?:G_GNUC_\w+(?:\(\w*\))?%s))' % ignore_decorators ++ stripped_decl = re.sub(regex, '', decl) + decl_list.append('<%s>\n%s\n%s%s\n' % + (structsym, symbol, deprecated, stripped_decl, structsym)) + if symbol in forward_decls: +diff --git a/tests/scan.py b/tests/scan.py +index ad63541..6d608b6 100755 +--- a/tests/scan.py ++++ b/tests/scan.py +@@ -552,6 +552,23 @@ class ScanHeaderContentStructs(ScanHeaderContentTestCase): + slist, doc_comments = self.scanHeaderContent([header]) + self.assertDecl('data', expected, slist) + ++ def test_HandleDeprecatedMemberDecorator(self): ++ """Struct with deprecated members.""" ++ header = textwrap.dedent("""\ ++ struct data { ++ int x1 G_GNUC_DEPRECATED; ++ int x2 G_GNUC_DEPRECATED_FOR(replacement); ++ };""") ++ expected = textwrap.dedent("""\ ++ struct data { ++ int x1; ++ int x2; ++ };""") ++ scan.InitScanner(self.options) ++ slist, doc_comments = self.scanHeaderContent( ++ header.splitlines(keepends=True)) ++ self.assertDecl('data', expected, slist) ++ + + class ScanHeaderContentUnions(ScanHeaderContentTestCase): + """Test parsing of union declarations.""" diff --git a/srcpkgs/gtk-doc/patches/0006-Implement-a-simple-tree-structure-without-using-anytree.patch b/srcpkgs/gtk-doc/patches/0006-Implement-a-simple-tree-structure-without-using-anytree.patch new file mode 100644 index 0000000000..5acf8f95ce --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0006-Implement-a-simple-tree-structure-without-using-anytree.patch @@ -0,0 +1,98 @@ +From: Simon McVittie +Date: Thu, 22 Aug 2019 09:31:19 +0100 +Subject: Implement a simple tree structure without using anytree + +anytree isn't currently available in Debian or Ubuntu, and seems like a +lot of code just to get a tree data structure. NIH just the bits we need. +--- + gtkdoc/mkhtml2.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- + tests/mkhtml2.py | 2 +- + 2 files changed, 52 insertions(+), 2 deletions(-) + +diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py +index 91860a7..48d918e 100644 +--- a/gtkdoc/mkhtml2.py ++++ b/gtkdoc/mkhtml2.py +@@ -101,7 +101,6 @@ import os + import shutil + import sys + +-from anytree import Node, PreOrderIter + from copy import deepcopy + from glob import glob + from lxml import etree +@@ -254,6 +253,57 @@ def get_chunk_titles(module, node, tree_node): + return result + + ++class PreOrderIter: ++ def __init__(self, node): ++ self.__node = node ++ ++ def __iter__(self): ++ yield self.__node ++ ++ for child in self.__node.descendants: ++ yield child ++ ++ ++class Node: ++ def __init__(self, name, parent=None, **kwargs): ++ self.name = name ++ self.__root = None ++ self.__attrs = kwargs ++ self.children = [] ++ ++ assert parent is None or isinstance(parent, Node) ++ self.parent = parent ++ if parent is not None: ++ self.__root = parent.root ++ parent.children.append(self) ++ ++ @property ++ def root(self): ++ return self.__root or self ++ ++ @property ++ def descendants(self): ++ ret = [] ++ ++ for child in self.children: ++ ret.append(child) ++ ++ for other in child.descendants: ++ ret.append(other) ++ ++ return ret ++ ++ def __iter__(self): ++ for child in self.children: ++ yield child ++ ++ def __getattr__(self, name): ++ try: ++ return self.__attrs[name] ++ except KeyError as e: ++ raise AttributeError(str(e)) ++ ++ + def chunk(xml_node, module, depth=0, idx=0, parent=None): + """Chunk the tree. + +diff --git a/tests/mkhtml2.py b/tests/mkhtml2.py +index c61ee27..439e7fe 100755 +--- a/tests/mkhtml2.py ++++ b/tests/mkhtml2.py +@@ -22,11 +22,11 @@ import logging + import textwrap + import unittest + +-from anytree import PreOrderIter + from lxml import etree + from parameterized import parameterized + + from gtkdoc import mkhtml2 ++from gtkdoc.mkhtml2 import PreOrderIter + + + class TestChunking(unittest.TestCase): diff --git a/srcpkgs/gtk-doc/patches/0007-revert_fix_build.patch b/srcpkgs/gtk-doc/patches/0007-revert_fix_build.patch new file mode 100644 index 0000000000..8327a6db1e --- /dev/null +++ b/srcpkgs/gtk-doc/patches/0007-revert_fix_build.patch @@ -0,0 +1,25 @@ +From: Kalev Lember +Date: Thu, 28 Nov 2019 14:38:59 +0100 +Subject: Partially revert a gtk-doc 1.31 change that broke e-d-s and NM + builds + +https://bugzilla.redhat.com/show_bug.cgi?id=1775560 +--- + gtkdoc/scan.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py +index 6c6534a..341939a 100644 +--- a/gtkdoc/scan.py ++++ b/gtkdoc/scan.py +@@ -978,8 +978,8 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options): + logging.info('struct/union level : %d', level) + + # here we want in_declaration=='', otherwise we have a partial declaration +- if in_declaration != '': +- raise RuntimeError('partial declaration (%s) : %s ' % (in_declaration, decl)) ++ #if in_declaration != '': ++ # raise RuntimeError('partial declaration (%s) : %s ' % (in_declaration, decl)) + + # print remaining forward declarations + for symbol in sorted(forward_decls.keys()): diff --git a/srcpkgs/gtk-doc/patches/pkg-config-hack.patch b/srcpkgs/gtk-doc/patches/0008-pkg-config-hack.patch similarity index 60% rename from srcpkgs/gtk-doc/patches/pkg-config-hack.patch rename to srcpkgs/gtk-doc/patches/0008-pkg-config-hack.patch index cac4613cb5..ab51c7ecce 100644 --- a/srcpkgs/gtk-doc/patches/pkg-config-hack.patch +++ b/srcpkgs/gtk-doc/patches/0008-pkg-config-hack.patch @@ -1,5 +1,5 @@ ---- gtkdoc/config.py.in.orig 2019-08-03 10:31:05.926508624 +0200 -+++ gtkdoc/config.py.in 2019-08-03 10:32:32.657073349 +0200 +--- a/gtkdoc/config.py.in ++++ b/gtkdoc/config.py.in @@ -3,7 +3,7 @@ version = "@VERSION@" # tools dblatex = '@DBLATEX@' diff --git a/srcpkgs/gtk-doc/template b/srcpkgs/gtk-doc/template index 439da0d796..276ef20c5e 100644 --- a/srcpkgs/gtk-doc/template +++ b/srcpkgs/gtk-doc/template @@ -1,8 +1,7 @@ # Template file for 'gtk-doc' pkgname=gtk-doc version=1.32 -revision=1 -archs=noarch +revision=2 build_style=gnu-configure pycompile_dirs="usr/share/gtk-doc/python/gtkdoc" hostmakedepends="gettext docbook-xml docbook-xsl itstool libxslt pkg-config python3" @@ -15,3 +14,4 @@ homepage="http://www.gtk.org/gtk-doc/" distfiles="${GNOME_SITE}/${pkgname}/${version}/${pkgname}-${version}.tar.xz" checksum=de0ef034fb17cb21ab0c635ec730d19746bce52984a6706e7bbec6fb5e0b907c python_version=3 +patch_args="-Np1"