~ubuntu-branches/debian/experimental/samba4/experimental

« back to all changes in this revision

Viewing changes to docs-xml/scripts/find_missing_doc

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-10-28 16:21:43 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20121028162143-zksa7dz2hu3fls89
Tags: 4.0.0~rc4+dfsg1-1
* New upstream release.
 + Bump minimum ldb version to 1.1.13.
* Switch to Git as VCS.
* Remove DM-Upload-Allowed field.
* Depend on heimdal-multidev rather than heimdal-dev.
 + Add 11_system_heimdal to support building with system heimdal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
# Copyright (C) 2007,2012 Jelmer Vernooij <jelmer@samba.org>
4
 
 
5
 
# This program is free software; you can redistribute it and/or modify
6
 
# it under the terms of the GNU General Public License as published by
7
 
# the Free Software Foundation; either version 3 of the License, or
8
 
# (at your option) any later version.
9
 
#
10
 
# This program is distributed in the hope that it will be useful,
11
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
# GNU General Public License for more details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License
16
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 
#
18
 
 
19
 
import optparse
20
 
import os
21
 
import re
22
 
 
23
 
parser = optparse.OptionParser("source_dir")
24
 
 
25
 
(opts, args) = parser.parse_args()
26
 
 
27
 
if len(args) == 1:
28
 
    topdir = args[0]
29
 
else:
30
 
    topdir = "."
31
 
 
32
 
# Reading links from manpage
33
 
 
34
 
curdir = os.getcwd()
35
 
doc = {}
36
 
 
37
 
os.chdir("smbdotconf");
38
 
 
39
 
f = os.popen("xsltproc --xinclude --param smb.context ALL generate-context.xsl parameters.all.xml", "r")
40
 
try:
41
 
    for l in f.readlines():
42
 
        m = re.match('<samba:parameter .*?name="([^"]*?)"', l)
43
 
        if m:
44
 
            name = m.group(1).replace(" ", "")
45
 
            doc[name] = False
46
 
finally:
47
 
    f.close()
48
 
 
49
 
os.chdir(curdir)
50
 
 
51
 
# Reading entries from source code
52
 
 
53
 
f = open(os.path.join(topdir, "lib/param/param_table.c"), "r")
54
 
 
55
 
# burn through the preceding lines
56
 
while True:
57
 
    l = f.readline()
58
 
    if l.startswith("static struct parm_struct parm_table"):
59
 
        break
60
 
 
61
 
for l in f.readlines():
62
 
    if re.match("^\s*\}\;\s*$", l):
63
 
        break
64
 
    # pull in the param names only
65
 
    if re.match(".*P_SEPARATOR.*", l):
66
 
        continue
67
 
    m = re.match("\s*\.label\s*=\s*\"(.*)\".*", l)
68
 
    if not m:
69
 
        continue
70
 
 
71
 
    name = m.group(1)
72
 
    name = name.replace(" ", "")
73
 
 
74
 
    if name.lower() in doc:
75
 
        doc[name.lower()] = True
76
 
    else:
77
 
      print "'%s' is not documented" % name
78
 
f.close()
79
 
 
80
 
# Try to find missing references
81
 
for key in doc.keys():
82
 
     if doc[key] == "FOUND":
83
 
         print "'$_' is documented but is not a configuration option"