Ticket #984: misc-doco.patch

File misc-doco.patch, 15.4 KB (added by https://www.google.com/accounts/o8/id?id=AItOawnSjgovXZr-_V3vGkvMSR0pc5LDykRc1Nc, 12 years ago)
  • redhat/bcfg2.spec.in

    diff --git a/redhat/bcfg2.spec.in b/redhat/bcfg2.spec.in
    index 9378e92..dd6e70f 100644
    a b BuildRequires: python-setuptools-devel 
    2626BuildRequires: python-setuptools 
    2727%endif 
    2828 
     29%if 0%{?rhel} <= 5 
     30BuildRequires: python-sphinx10 
     31# the python-sphinx10 package doesn't set sys.path correctly, so we 
     32# have to do it for them 
     33%define pythonpath %(rpm -ql python-sphinx10 | grep '\.egg$') 
     34%else 
     35BuildRequires: python-sphinx >= 0.6 
     36%endif 
     37 
     38BuildRequires:    python-lxml 
     39 
    2940%if "%{py_ver}" == "2.4" 
    3041Requires:         python-elementtree 
    3142%else if "%{py_ver}" < "2.5" 
    Requires(postun): /sbin/service 
    8192%description server 
    8293Configuration management server 
    8394 
     95%package doc 
     96Summary:          Configuration management system documentation 
     97Group:            Documentation 
     98 
     99%description doc 
     100Configuration management system documentation 
     101 
    84102%prep 
    85103%setup -q -n %{name}-%{version}-%{release} 
    86104 
    done 
    104122 
    105123%build 
    106124%{__python} -c 'import setuptools; execfile("setup.py")' build 
     125%{__python} -c 'import setuptools; execfile("setup.py")' build_dtddoc 
     126 
     127%{?pythonpath: export PYTHONPATH="%{pythonpath}"} 
     128%{__python} -c 'import setuptools; execfile("setup.py")' build_sphinx 
    107129 
    108130%install 
    109131rm -rf %{buildroot} 
    mkdir -p %{buildroot}%{_sysconfdir}/sysconfig 
    117139mkdir -p %{buildroot}%{_libexecdir} 
    118140mkdir -p %{buildroot}%{_var}/lib/bcfg2 
    119141mkdir -p %{buildroot}%{_var}/cache/bcfg2 
     142mkdir -p %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version} 
    120143 
    121144mv %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir} 
    122145 
    install -m 755 tools/bcfg2-cron %{buildroot}%{_libexecdir}/bcfg2-cron 
    128151 
    129152install -m 644 debian/bcfg2.default %{buildroot}%{_sysconfdir}/sysconfig/bcfg2 
    130153 
     154mv build/sphinx/html/* %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version} 
     155mv build/dtd %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version}/ 
     156 
    131157touch %{buildroot}%{_sysconfdir}/bcfg2.conf 
    132158touch %{buildroot}%{_sysconfdir}/bcfg2.key 
    133159 
    fi 
    216242 
    217243%dir %{_var}/lib/bcfg2 
    218244 
     245%files doc 
     246%defattr(0644,root,root,-) 
     247%doc %{_defaultdocdir}/bcfg2-doc-%{version} 
     248 
    219249%changelog 
     250* Thu Jan 27 2011 Chris St. Pierre <[email protected]> 1.2.0pre1-0.0 
     251- Added -doc sub-package 
     252 
    220253* Wed Jun 15 2009 Sol Jerome <[email protected]> 1.0pre4-0.1 
    221254- Remove python-cheetah dependency 
    222255 
  • schemas/bundle.xsd

    diff --git a/schemas/bundle.xsd b/schemas/bundle.xsd
    index d674fb8..bf72915 100644
    a b  
    1414 
    1515  <xsd:complexType name='GroupType'> 
    1616    <xsd:choice minOccurs='0' maxOccurs='unbounded'> 
    17       <xsd:element name='Package' type='StructureEntry'/> 
    18       <xsd:element name='Path' type='PathEntry'/> 
    19       <xsd:element name='Service' type='StructureEntry'/> 
    20       <xsd:element name='Action' type='StructureEntry'/> 
    21       <xsd:element name='BoundPackage' type='PackageType'/> 
    22       <xsd:element name='BoundPath' type='BoundPathEntry'/> 
    23       <xsd:element name='BoundService' type='ServiceType'/> 
    24       <xsd:element name='BoundAction' type='ActionType'/> 
    25       <xsd:element name='Group' type='GroupType'/> 
     17      <xsd:element name='Package' type='StructureEntry'> 
     18        <xsd:annotation> 
     19          <xsd:documentation> 
     20            Abstract implementation of a Package entry.  The full 
     21            specification will be included in Rules. 
     22          </xsd:documentation> 
     23        </xsd:annotation> 
     24      </xsd:element> 
     25      <xsd:element name='Path' type='PathEntry'> 
     26        <xsd:annotation> 
     27          <xsd:documentation> 
     28            Abstract implementation of a Path entry.  The entry will 
     29            either be handled by Cfg, TGenshi, or another 
     30            DirectoryBacked plugin; or handled by Rules, in which case 
     31            the full specification of this entry will be included in 
     32            Rules. 
     33          </xsd:documentation> 
     34        </xsd:annotation> 
     35      </xsd:element> 
     36      <xsd:element name='Service' type='StructureEntry'> 
     37        <xsd:annotation> 
     38          <xsd:documentation> 
     39            Abstract implementation of a Service entry.  The full 
     40            specification will be included in Rules. 
     41          </xsd:documentation> 
     42        </xsd:annotation> 
     43      </xsd:element> 
     44      <xsd:element name='Action' type='StructureEntry'> 
     45        <xsd:annotation> 
     46          <xsd:documentation> 
     47            Abstract implementation of an Action entry.  The full 
     48            specification will be included in Rules. 
     49          </xsd:documentation> 
     50        </xsd:annotation> 
     51      </xsd:element> 
     52      <xsd:element name='BoundPackage' type='PackageType'> 
     53        <xsd:annotation> 
     54          <xsd:documentation> 
     55            Fully bound description of a software package to be managed. 
     56          </xsd:documentation> 
     57        </xsd:annotation> 
     58      </xsd:element> 
     59      <xsd:element name='BoundPath' type='BoundPathEntry'> 
     60        <xsd:annotation> 
     61          <xsd:documentation> 
     62            Fully bound description of a filesystem path to be handled 
     63            by the POSIX driver. 
     64          </xsd:documentation> 
     65        </xsd:annotation> 
     66      </xsd:element> 
     67      <xsd:element name='BoundService' type='ServiceType'> 
     68        <xsd:annotation> 
     69          <xsd:documentation> 
     70            Fully bound description of a system service to be managed. 
     71          </xsd:documentation> 
     72        </xsd:annotation> 
     73      </xsd:element> 
     74      <xsd:element name='BoundAction' type='ActionType'> 
     75        <xsd:annotation> 
     76          <xsd:documentation> 
     77            Fully bound description of a command to be run. 
     78          </xsd:documentation> 
     79        </xsd:annotation> 
     80      </xsd:element> 
     81      <xsd:element name='Group' type='GroupType'> 
     82        <xsd:annotation> 
     83          <xsd:documentation> 
     84            Elements within Group tags only apply to clients that are 
     85            members of that group (or vice-versa; see #element_negate 
     86            below) 
     87          </xsd:documentation> 
     88        </xsd:annotation> 
     89      </xsd:element> 
    2690    </xsd:choice> 
    27     <xsd:attribute type='xsd:string' name='name' use='required'/> 
    28     <xsd:attribute type='xsd:string' name='negate' /> 
     91    <xsd:attribute type='xsd:string' name='name' use='required'> 
     92      <xsd:annotation> 
     93        <xsd:documentation>The group name</xsd:documentation> 
     94      </xsd:annotation> 
     95    </xsd:attribute> 
     96    <xsd:attribute type='xsd:string' name='negate'> 
     97      <xsd:annotation> 
     98        <xsd:documentation> 
     99          Negate the sense of this group; i.e., entries within this 
     100          tag are only used on clients that are not members of the 
     101          group 
     102        </xsd:documentation> 
     103      </xsd:annotation> 
     104    </xsd:attribute> 
    29105  </xsd:complexType> 
    30106 
    31107  <xsd:element name='Bundle'> 
     108      <xsd:annotation> 
     109        <xsd:documentation> 
     110          A bundle describes a group of inter-dependent configuration 
     111          entries, such as the combination of packages, configuration 
     112          files, and service activations that comprise typical Unix 
     113          daemons. Bundles are used to add groups of configuration 
     114          entries to the inventory of client configurations, as 
     115          opposed to describing particular versions of those 
     116          entries. For example, a bundle could say that the 
     117          configuration file ``/etc/passwd`` should be included in a 
     118          configuration, but will not describe the particular version 
     119          of ``/etc/passwd`` that a given client will receive. 
     120        </xsd:documentation> 
     121      </xsd:annotation> 
    32122    <xsd:complexType> 
    33123      <xsd:choice minOccurs='0' maxOccurs='unbounded'> 
    34         <xsd:element name='Package' type='StructureEntry'/> 
    35         <xsd:element name='Path' type='PathEntry'/> 
    36         <xsd:element name='Service' type='StructureEntry'/> 
    37         <xsd:element name='Action' type='StructureEntry'/>        
    38         <xsd:element name='BoundPackage' type='PackageType'/> 
    39         <xsd:element name='BoundPath' type='BoundPathEntry'/> 
    40         <xsd:element name='BoundService' type='ServiceType'/> 
    41         <xsd:element name='BoundAction' type='ActionType'/> 
    42         <xsd:element name='Group' type='GroupType'/> 
     124        <xsd:element name='Package' type='StructureEntry'> 
     125          <xsd:annotation> 
     126            <xsd:documentation> 
     127              Abstract implementation of a Package entry.  The full 
     128              specification will be included in Rules. 
     129            </xsd:documentation> 
     130          </xsd:annotation> 
     131        </xsd:element> 
     132        <xsd:element name='Path' type='PathEntry'> 
     133          <xsd:annotation> 
     134            <xsd:documentation> 
     135              Abstract implementation of a Path entry.  The entry will 
     136              either be handled by Cfg, TGenshi, or another 
     137              DirectoryBacked plugin; or handled by Rules, in which case 
     138              the full specification of this entry will be included in 
     139              Rules. 
     140            </xsd:documentation> 
     141          </xsd:annotation> 
     142        </xsd:element> 
     143        <xsd:element name='Service' type='StructureEntry'> 
     144          <xsd:annotation> 
     145            <xsd:documentation> 
     146              Abstract implementation of a Service entry.  The full 
     147              specification will be included in Rules. 
     148            </xsd:documentation> 
     149          </xsd:annotation> 
     150        </xsd:element> 
     151        <xsd:element name='Action' type='StructureEntry'> 
     152          <xsd:annotation> 
     153            <xsd:documentation> 
     154              Abstract implementation of an Action entry.  The full 
     155              specification will be included in Rules. 
     156            </xsd:documentation> 
     157          </xsd:annotation> 
     158        </xsd:element> 
     159        <xsd:element name='BoundPackage' type='PackageType'> 
     160          <xsd:annotation> 
     161            <xsd:documentation> 
     162              Fully bound description of a software package to be managed. 
     163            </xsd:documentation> 
     164          </xsd:annotation> 
     165        </xsd:element> 
     166        <xsd:element name='BoundPath' type='BoundPathEntry'> 
     167          <xsd:annotation> 
     168            <xsd:documentation> 
     169              Fully bound description of a filesystem path to be handled 
     170              by the POSIX driver. 
     171            </xsd:documentation> 
     172          </xsd:annotation> 
     173        </xsd:element> 
     174        <xsd:element name='BoundService' type='ServiceType'> 
     175          <xsd:annotation> 
     176            <xsd:documentation> 
     177              Fully bound description of a system service to be managed. 
     178            </xsd:documentation> 
     179          </xsd:annotation> 
     180        </xsd:element> 
     181        <xsd:element name='BoundAction' type='ActionType'> 
     182          <xsd:annotation> 
     183            <xsd:documentation> 
     184              Fully bound description of a command to be run. 
     185            </xsd:documentation> 
     186          </xsd:annotation> 
     187        </xsd:element> 
     188        <xsd:element name='Group' type='GroupType'> 
     189          <xsd:annotation> 
     190            <xsd:documentation> 
     191              Elements within Group tags only apply to clients that are 
     192              members of that group 
     193            </xsd:documentation> 
     194          </xsd:annotation> 
     195        </xsd:element> 
    43196      </xsd:choice> 
    44197      <xsd:attribute type='xsd:string' name='description' /> 
    45198      <xsd:attribute type='xsd:string' name='name'/> 
  • setup.py

    diff --git a/setup.py b/setup.py
    index ad2fa73..9eaa6f6 100644
    a b  
    11#!/usr/bin/env python 
    22 
    33from distutils.core import setup 
     4from distutils.core import Command 
     5from fnmatch import fnmatch 
     6from glob import glob 
     7import os.path 
     8import lxml.etree 
     9 
     10class BuildDTDDoc (Command): 
     11    """Build DTD documentation""" 
     12 
     13    description = "Build DTD documentation" 
     14 
     15    # List of option tuples: long name, short name (None if no short 
     16    # name), and help string. 
     17    user_options = [ 
     18        ('links-file=', 'l', 'Links file'), 
     19        ('source-dir=', 's', 'Source directory'), 
     20        ('build-dir=', None, 'Build directory'), 
     21        ('xslt=',      None, 'XSLT file'), 
     22                   ] 
     23 
     24    def initialize_options(self): 
     25        """Set default values for all the options that this command 
     26        supports.""" 
     27 
     28        self.build_links = False 
     29        self.links_file = None 
     30        self.source_dir = None 
     31        self.build_dir  = None 
     32        self.xslt       = None 
     33 
     34    def finalize_options(self): 
     35        """Set final values for all the options that this command 
     36        supports.""" 
     37        if self.source_dir is None: 
     38            if os.path.isdir('schemas'): 
     39                for root, dirnames, filenames in os.walk('schemas'): 
     40                    for filename in filenames: 
     41                        if fnmatch(filename, '*.xsd'): 
     42                            self.source_dir = root 
     43                            self.announce('Using source directory %s' % root) 
     44                            break 
     45        self.ensure_dirname('source_dir') 
     46        self.source_dir = os.path.abspath(self.source_dir) 
     47 
     48        if self.build_dir is None: 
     49            build = self.get_finalized_command('build') 
     50            self.build_dir = os.path.join(build.build_base, 'dtd') 
     51            self.mkpath(self.build_dir) 
     52 
     53        if self.links_file is None: 
     54            self.links_file = "links.xml" 
     55            if os.path.isfile(os.path.join(self.source_dir, "links.xml")): 
     56                self.announce("Using linksFile links.xml") 
     57            else: 
     58                self.build_links = True 
     59 
     60        if self.xslt is None: 
     61            xsl_files = glob(os.path.join(self.source_dir, '*.xsl')) 
     62            if xsl_files: 
     63                self.xslt = xsl_files[0] 
     64                self.announce("Using XSLT file %s" % self.xslt) 
     65        self.ensure_filename('xslt') 
     66 
     67    def run (self): 
     68        """Perform XSLT transforms, writing output to self.build_dir""" 
     69 
     70        xslt = lxml.etree.parse(self.xslt).getroot() 
     71        transform = lxml.etree.XSLT(xslt) 
     72 
     73        if self.build_links: 
     74            self.announce("Building linksFile %s" % self.links_file) 
     75            links_xml = \ 
     76                lxml.etree.Element('links', 
     77                                   attrib={'xmlns':"http://titanium.dstc.edu.au/xml/xs3p"}) 
     78            for filename in glob(os.path.join(self.source_dir, '*.xsd')): 
     79                attrib = {'file-location':os.path.basename(filename), 
     80                          'docfile-location':os.path.splitext(os.path.basename(filename))[0] + ".html"} 
     81                links_xml.append(lxml.etree.Element('schema', attrib=attrib)) 
     82            open(os.path.join(self.source_dir, self.links_file), 
     83                 "w").write(lxml.etree.tostring(links_xml)) 
     84 
     85        # build parameter dict 
     86        params = {'printLegend':"'false'", 
     87                  'printGlossary':"'false'", 
     88                  'sortByComponent':"'false'",} 
     89        if self.links_file is not None: 
     90            params['linksFile'] = "'%s'" % self.links_file 
     91            params['searchIncludedSchemas'] = "'true'" 
     92 
     93        for filename in glob(os.path.join(self.source_dir, '*.xsd')): 
     94            outfile = \ 
     95                os.path.join(self.build_dir, 
     96                             os.path.splitext(os.path.basename(filename))[0] + 
     97                             ".html") 
     98            self.announce("Transforming %s to %s" % (filename, outfile)) 
     99            xml = lxml.etree.parse(filename).getroot() 
     100            xhtml = str(transform(xml, **params)) 
     101            open(outfile, 'w').write(xhtml) 
     102 
     103cmdclass = {} 
     104 
    4105try: 
    5106    from sphinx.setup_command import BuildDoc 
    6     cmdclass = {'build_sphinx': BuildDoc} 
     107    cmdclass['build_sphinx'] = BuildDoc 
    7108except ImportError: 
    8     cmdclass = {} 
    9 from glob import glob 
     109    pass 
     110 
     111cmdclass['build_dtddoc'] = BuildDTDDoc 
    10112 
    11113setup(cmdclass=cmdclass, 
    12114      name="Bcfg2",