Debian Codegraph @

doc/man/generate-botch-manpage.py

raw
1 #!/usr/bin/env python3
2
3 import os
4 import sys
5
6 tools = {
7 "set operations on Packages or Sources files": [
8 "botch-packages-difference",
9 "botch-packages-intersection",
10 "botch-packages-union",
11 ],
12 "transform Packages and Sources control files": [
13 "botch-latest-version",
14 "botch-bin2src",
15 "botch-src2bin",
16 "botch-clean-repository",
17 "botch-add-arch",
18 "botch-convert-arch",
19 "botch-remove-virtual-disjunctions",
20 "botch-optuniv",
21 "botch-fix-cross-problems",
22 "botch-filter-src-builds-for",
23 ],
24 "analysis of Packages and Sources control files": [
25 "botch-packages-diff",
26 "botch-ma-diff",
27 "botch-apply-ma-diff",
28 "botch-check-ma-same-versions",
29 ],
30 "create graphs of different types": [
31 "botch-create-graph",
32 "botch-annotate-strong",
33 ],
34 "conversion of graphs": [
35 "botch-buildgraph2srcgraph",
36 "botch-graphml2dot",
37 "botch-collapse-srcgraph",
38 "botch-profile-build-fvs",
39 "botch-buildgraph2packages",
40 "botch-graph-tred",
41 "botch-graph2text",
42 ],
43 "extract regions from graphs": [
44 "botch-graph-neighborhood",
45 "botch-extract-scc",
46 "botch-graph-ancestors",
47 "botch-graph-descendants",
48 "botch-graph-shortest-path",
49 "botch-graph-sinks",
50 "botch-graph-sources",
51 ],
52 "dose3 wrappers": [
53 "botch-dose2html",
54 "botch-buildcheck-more-problems",
55 "botch-distcheck-more-problems",
56 ],
57 "analyze graphs": [
58 "botch-calcportsmetric",
59 "botch-calculate-fas",
60 "botch-find-fvs",
61 "botch-graph-difference",
62 "botch-graph-info",
63 "botch-partial-order",
64 "botch-print-stats",
65 "botch-multiarch-interpreter-problem",
66 ],
67 "create build orders": [
68 "botch-build-fixpoint",
69 "botch-build-order-from-zero",
70 "botch-wanna-build-sortblockers",
71 ],
72 "handling of botch-internal formats": [
73 "botch-stat-html",
74 "botch-droppable-diff",
75 "botch-droppable-union",
76 "botch-checkfas",
77 "botch-fasofstats",
78 "botch-download-pkgsrc",
79 ],
80 "shell scripts connecting the tools for meaningful operations": [
81 "botch-cross",
82 "botch-native",
83 "botch-transition",
84 "botch-y-u-no-bootstrap",
85 "botch-y-u-b-d-transitive-essential",
86 ]
87 }
88
89 toolnames = set([t for s in tools.values() for t in s])
90
91 scriptpath = os.path.dirname(os.path.realpath(__file__))
92 manpages = set([f[:-4] for f in os.listdir(scriptpath)
93 if os.path.isfile(os.path.join(scriptpath,f))
94 and f.startswith("botch-") and f.endswith(".pod")])
95
96 tool_but_no_man = toolnames - manpages
97
98 if tool_but_no_man:
99 print("tool bat no man: %s"%tool_but_no_man, file=sys.stderr)
100 exit(1)
101
102 man_but_no_tool = manpages - toolnames
103
104 if man_but_no_tool:
105 print("man but no tool: %s"%man_but_no_tool, file=sys.stderr)
106 exit(1)
107
108 print("""
109 =head1 NAME
110
111 botch - bootstrap/build order tool chain
112
113 =head1 DESCRIPTION
114
115 botch is a collection of tools to create and analyze dependency graphs. This
116 task is facilitated by a range of individual tools which use the deb822 and
117 graphml formats to exchange information with each other.
118
119 Also consider browsing the HTML based doc-base Manual at F</usr/share/doc/botch/wiki/Home.html>
120
121 The tools that botch ships allow one to:
122
123 =over 4
124 """)
125
126 for n,s in tools.items():
127 print("""
128 =item %s
129
130 =over 4
131 """%n)
132 for t in s:
133 with open(os.path.join(scriptpath,"%s.pod"%t)) as f:
134 l = f.readlines()[2]
135 try:
136 tn, descr = l.split(" - ", 1)
137 except:
138 raise Exception("invalid third line format")
139 if tn != t:
140 raise Exception("invalid third line format")
141 descr = descr.strip()
142 print("""
143 =item B<%s>: %s
144 """%(tn, descr))
145
146 print("""
147 =back
148 """)
149
150 print("""
151 =back
152
153 =head1 SEE ALSO
154
155 Debian doc-base Manual F</usr/share/doc/botch/wiki/Home.html>
156
157 =head1 AUTHOR
158
159 This man page was written by Johannes Schauer. Botch is written by Johannes
160 Schauer and Pietro Abate.
161
162 =head1 COPYRIGHT
163
164 Copyright 2012-2014 Johannes Schauer, Pietro Abate
165
166 This program is free software: you can redistribute it and/or modify it under
167 the terms of the GNU Lesser General Public License as published by the Free
168 Software Foundation, either version 3 of the License, or (at your option) any
169 later version. A special linking exception to the GNU Lesser General Public
170 License applies to this library, see the COPYING file for more information.
171 """)