mirror of
https://github.com/samba-team/samba.git
synced 2025-01-05 09:18:06 +03:00
docs: define and include entities for the docs
This allows for dynamic default settings to be generated. Change-Id: If8b93d233fb941bc7e3073ccf4b5ec0b0a231bd9 Pair-programmed-with: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
0e552e03ae
commit
57ba012c10
@ -806,7 +806,7 @@ def MANPAGES(bld, manpages, install):
|
|||||||
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
|
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
|
||||||
Build.BuildContext.MANPAGES = MANPAGES
|
Build.BuildContext.MANPAGES = MANPAGES
|
||||||
|
|
||||||
def SAMBAMANPAGES(bld, manpages):
|
def SAMBAMANPAGES(bld, manpages, extra_source=None):
|
||||||
'''build and install manual pages'''
|
'''build and install manual pages'''
|
||||||
bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
|
bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
|
||||||
bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
|
bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
|
||||||
@ -814,13 +814,15 @@ def SAMBAMANPAGES(bld, manpages):
|
|||||||
|
|
||||||
for m in manpages.split():
|
for m in manpages.split():
|
||||||
source = m + '.xml'
|
source = m + '.xml'
|
||||||
|
if extra_source is not None:
|
||||||
|
source = [source, extra_source]
|
||||||
bld.SAMBA_GENERATOR(m,
|
bld.SAMBA_GENERATOR(m,
|
||||||
source=source,
|
source=source,
|
||||||
target=m,
|
target=m,
|
||||||
group='final',
|
group='final',
|
||||||
rule='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
|
rule='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
|
||||||
export XML_CATALOG_FILES
|
export XML_CATALOG_FILES
|
||||||
${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC}
|
${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC[0].abspath(env)}
|
||||||
${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
|
${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
|
||||||
)
|
)
|
||||||
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
|
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
|
||||||
|
@ -98,9 +98,19 @@ def smbdotconf_generate_parameter_list(task):
|
|||||||
parameter_all = task.outputs[0].bldpath(task.env)
|
parameter_all = task.outputs[0].bldpath(task.env)
|
||||||
articles = task.inputs
|
articles = task.inputs
|
||||||
|
|
||||||
t = '<section xmlns:xi="http://www.w3.org/2001/XInclude">\n'
|
entities = bld.pathconfig_entities()
|
||||||
|
t = "<!DOCTYPE section [\n"
|
||||||
|
|
||||||
|
for entity in entities:
|
||||||
|
t += "%s\n" % entity
|
||||||
|
|
||||||
|
t += "]>\n"
|
||||||
|
t += "<section>\n"
|
||||||
for article in articles:
|
for article in articles:
|
||||||
t += "<xi:include href='" + article.abspath(task.env) + "' parse='xml'/>\n"
|
f = open(article.abspath(task.env), 'r')
|
||||||
|
t += f.read()
|
||||||
|
f.close()
|
||||||
|
|
||||||
t += "</section>\n"
|
t += "</section>\n"
|
||||||
save_file(parameter_all, t , create_dir=True)
|
save_file(parameter_all, t , create_dir=True)
|
||||||
return 0
|
return 0
|
||||||
@ -112,8 +122,9 @@ def SMBDOTCONF_MANPAGE(bld, target):
|
|||||||
bld.SAMBA_GENERATOR(parameter_all,
|
bld.SAMBA_GENERATOR(parameter_all,
|
||||||
source=articles,
|
source=articles,
|
||||||
target=parameter_all,
|
target=parameter_all,
|
||||||
rule=smbdotconf_generate_parameter_list)
|
rule=smbdotconf_generate_parameter_list,
|
||||||
bld.SAMBAMANPAGES(target)
|
always=True)
|
||||||
|
bld.SAMBAMANPAGES(target, parameter_all)
|
||||||
|
|
||||||
if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
|
if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
|
||||||
|
|
||||||
|
@ -345,29 +345,48 @@ def configure(conf):
|
|||||||
conf.start_msg("Dynconfig[%s]: " % (varname))
|
conf.start_msg("Dynconfig[%s]: " % (varname))
|
||||||
conf.end_msg("'%s'" % (value), 'GREEN')
|
conf.end_msg("'%s'" % (value), 'GREEN')
|
||||||
|
|
||||||
def dynconfig_cflags(bld, list=None):
|
def get_override(bld):
|
||||||
'''work out the extra CFLAGS for dynconfig.c'''
|
|
||||||
cflags = []
|
|
||||||
# override some paths when running from the build directory
|
|
||||||
override = { 'MODULESDIR' : 'bin/modules',
|
override = { 'MODULESDIR' : 'bin/modules',
|
||||||
'PYTHONDIR' : 'bin/python',
|
'PYTHONDIR' : 'bin/python',
|
||||||
'PYTHONARCHDIR' : 'bin/python',
|
'PYTHONARCHDIR' : 'bin/python',
|
||||||
'BINDIR' : 'bin',
|
'BINDIR' : 'bin',
|
||||||
'SBINDIR' : 'bin',
|
'SBINDIR' : 'bin',
|
||||||
'CODEPAGEDIR' : os.path.join(bld.env.srcdir, 'codepages'),
|
'CODEPAGEDIR' : 'codepages',
|
||||||
'SCRIPTSBINDIR' : os.path.join(bld.env.srcdir, 'source4/scripting/bin'),
|
'SCRIPTSBINDIR' : 'source4/scripting/bin',
|
||||||
'SETUPDIR' : os.path.join(bld.env.srcdir, 'source4/setup') }
|
'SETUPDIR' : 'source4/setup'
|
||||||
|
}
|
||||||
|
return override
|
||||||
|
|
||||||
|
def dynconfig_cflags(bld, list=None):
|
||||||
|
'''work out the extra CFLAGS for dynconfig.c'''
|
||||||
|
cflags = []
|
||||||
for varname in dynconfig.keys():
|
for varname in dynconfig.keys():
|
||||||
if list and not varname in list:
|
if list and not varname in list:
|
||||||
continue
|
continue
|
||||||
value = bld.env[varname]
|
value = bld.env[varname]
|
||||||
if not Options.is_install:
|
if not Options.is_install:
|
||||||
|
override = get_override(bld)
|
||||||
if varname in override:
|
if varname in override:
|
||||||
value = os.path.join(os.getcwd(), override[varname])
|
value = os.path.join(bld.env.srcdir, override[varname])
|
||||||
cflags.append('-D%s="%s"' % (varname, value))
|
cflags.append('-D%s="%s"' % (varname, value))
|
||||||
return cflags
|
return cflags
|
||||||
Build.BuildContext.dynconfig_cflags = dynconfig_cflags
|
Build.BuildContext.dynconfig_cflags = dynconfig_cflags
|
||||||
|
|
||||||
|
def pathconfig_entities(bld, list=None):
|
||||||
|
'''work out the extra entities for the docs'''
|
||||||
|
entities = []
|
||||||
|
for varname in dynconfig.keys():
|
||||||
|
if list and not varname in list:
|
||||||
|
continue
|
||||||
|
value = bld.env[varname]
|
||||||
|
if not Options.is_install:
|
||||||
|
override = get_override(bld)
|
||||||
|
if varname in override:
|
||||||
|
value = os.path.join(bld.env.srcdir, override[varname])
|
||||||
|
entities.append("<!ENTITY pathconfig.%s '%s'>" % (varname, value))
|
||||||
|
return entities
|
||||||
|
Build.BuildContext.pathconfig_entities = pathconfig_entities
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
cflags = bld.dynconfig_cflags()
|
cflags = bld.dynconfig_cflags()
|
||||||
version_header = 'version.h'
|
version_header = 'version.h'
|
||||||
|
Loading…
Reference in New Issue
Block a user