Parsing XML files using plain bash (only builtins used) - the x2sh approach

M.Canales.es manuel at linuxfromscratch.org
Mon Feb 13 11:19:18 PST 2006


El Lunes, 13 de Febrero de 2006 11:44, George Makrydakis escribió:
> Some of you may remember a previous post I made regarding this idea: Do not
> rely on third - party binaries for parsing the XML files, but only on plain
> bash. Although this may be inefficient because it increases script
> complexity of a not - optimal language for "programming", a bash script
> fully self - hosting a jhalfs building method is a nice challenge.

A very nice work :-)

That could be a nice feature for jhalfs if the next issues can be solved:

  - To can drop the libxml/libxslt dependency, the parser should be able to 
handle all *LFS books. That meant profile support for HLFS and XInclude/XPath 
support for CLFS. Maybe the profile one could be done, but IMHO the 
XInclude/XPath one is beyond Bash capabilities.

 - The parser should to create the output subdirs and numbered scripts. 
Subdirs are needed to keep separate each build phase, and numbered scripts to 
can build the packages in their proper order.

 - Parsing time:

$ time { ./prototype.sh > glibc.sh; }

real    0m5.238s
user    0m4.930s
sys     0m0.291s

$ time { xsltproc --nonet --xinclude dump-lfs-scripts.xsl glibc.xml; }

real    0m0.106s
user    0m0.096s
sys     0m0.010s


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfromscratch.org
LFS en castellano: http://www.escomposlinux.org/lfs-es http://www.lfs-es.com
TLDP-ES:                           http://es.tldp.org



More information about the alfs-discuss mailing list