1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +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:
Garming Sam 2014-01-09 12:01:18 +13:00 committed by Michael Adam
parent 0e552e03ae
commit 57ba012c10
3 changed files with 46 additions and 14 deletions

View File

@ -806,7 +806,7 @@ def MANPAGES(bld, manpages, install):
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
Build.BuildContext.MANPAGES = MANPAGES
def SAMBAMANPAGES(bld, manpages):
def SAMBAMANPAGES(bld, manpages, extra_source=None):
'''build and install manual pages'''
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'
@ -814,13 +814,15 @@ def SAMBAMANPAGES(bld, manpages):
for m in manpages.split():
source = m + '.xml'
if extra_source is not None:
source = [source, extra_source]
bld.SAMBA_GENERATOR(m,
source=source,
target=m,
group='final',
rule='''XML_CATALOG_FILES="${SAMBA_CATALOGS}"
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'''
)
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)

View File

@ -98,9 +98,19 @@ def smbdotconf_generate_parameter_list(task):
parameter_all = task.outputs[0].bldpath(task.env)
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:
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"
save_file(parameter_all, t , create_dir=True)
return 0
@ -112,8 +122,9 @@ def SMBDOTCONF_MANPAGE(bld, target):
bld.SAMBA_GENERATOR(parameter_all,
source=articles,
target=parameter_all,
rule=smbdotconf_generate_parameter_list)
bld.SAMBAMANPAGES(target)
rule=smbdotconf_generate_parameter_list,
always=True)
bld.SAMBAMANPAGES(target, parameter_all)
if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):

View File

@ -345,29 +345,48 @@ def configure(conf):
conf.start_msg("Dynconfig[%s]: " % (varname))
conf.end_msg("'%s'" % (value), 'GREEN')
def dynconfig_cflags(bld, list=None):
'''work out the extra CFLAGS for dynconfig.c'''
cflags = []
# override some paths when running from the build directory
def get_override(bld):
override = { 'MODULESDIR' : 'bin/modules',
'PYTHONDIR' : 'bin/python',
'PYTHONARCHDIR' : 'bin/python',
'BINDIR' : 'bin',
'SBINDIR' : 'bin',
'CODEPAGEDIR' : os.path.join(bld.env.srcdir, 'codepages'),
'SCRIPTSBINDIR' : os.path.join(bld.env.srcdir, 'source4/scripting/bin'),
'SETUPDIR' : os.path.join(bld.env.srcdir, 'source4/setup') }
'CODEPAGEDIR' : 'codepages',
'SCRIPTSBINDIR' : 'source4/scripting/bin',
'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():
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(os.getcwd(), override[varname])
value = os.path.join(bld.env.srcdir, override[varname])
cflags.append('-D%s="%s"' % (varname, value))
return 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):
cflags = bld.dynconfig_cflags()
version_header = 'version.h'