From 8decb3267be14596c377155d6bc84a0eb61f04e9 Mon Sep 17 00:00:00 2001 From: Lennart Johansson Date: Thu, 2 Jun 2016 13:41:16 +0200 Subject: Doc Add autovariables from manifest, poky.ent, enea.conf Add autovariable from manifest repository name, e.g. the profile name Add autovariables from poky.ent, e.g. Yocto version etc.. in pardoc-distro Add autovariables from enea.conf e.g. release MAJOR MINOR via generated s_docsrc_common/pardoc-distro and also pick up MAJOR MINOR into the make system to create BOOK_VER => BL_LABEL on books Add autocreate build_boot chapter in release info from the README files in all included targets Adapt book XML files to the above Currently this makes the Makefile and init scripts identical in different el6-.git All are now automatic: Just clone el6-xxxx.git and cd el6-xxx/doc ; make doc and all are done until the books are built and ready. It takes several minutes to autofetch all from git using the repo command according to the target manifests before the books start to build. Rebuilding books are quick. Signed-off-by: Lennart Johansson --- doc/initbuildboot.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 doc/initbuildboot.sh (limited to 'doc/initbuildboot.sh') diff --git a/doc/initbuildboot.sh b/doc/initbuildboot.sh new file mode 100644 index 0000000..72606a6 --- /dev/null +++ b/doc/initbuildboot.sh @@ -0,0 +1,111 @@ +#!/bin/sh +VER="R0.06" + +BBTEMPLATE= +BBXML= + +USAGE="`basename $0` -xml buildbootxml-to-create -template templatexml-file ($VER) + Currently only supports sequence types Build-command: and Boot-command: + Both files should have path book-*release-info/doc/ + Creates the XML file from the template, inserting build/boot commands + from the various s_targets/XXXtargetXXX/README files + at the place in template with >SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE< + ignoring rest of template + The code tries to fold too long lines, but this is not perfect. Best would + be if the command lines already in README are short enough, e.g. by + using short variables, which work both on shell and uboot command lines" + +while echo "x$1" | egrep '^x-' >/dev/null 2>&1 +do + OPT="$1" ; shift + if [ "$OPT" = "--help" -o "$OPT" = "-h" -o "$OPT" = "-help" ] ; then echo "$USAGE" ; exit ; fi + if [ "$OPT" = "-xml" ] ; then BBXML="$1" ; shift; fi + if [ "$OPT" = "-template" ] ; then BBTEMPLATE="$1" ; shift; fi +done +if [ "$BBTEMPLATE" = "" ]; then echo "ERROR: Missing option -template templatefile"; exit ; fi +if [ "$BBXML" = "" ]; then echo "ERROR: Missing option -xml buildbootxml-to-create"; exit ; fi +if [ ! -f "$BBTEMPLATE" ]; then echo "ERROR: Missing templatefile '$BBTEMPLATE'"; exit; fi +if [ ! -d "`dirname \"$BBXML\"`" ]; then echo "ERROR: Missing parent directory for '$BBXML'"; exit ; fi + +echo "`basename $0` Creating $BBXML from" +TARGETREADMES=`cd s_targets ; ls -d */README | tr '\n' ' '` +echo " $TARGETREADMES" + +# README file formats: +# a) Sequence starts: ___ XXXX:yyyy or ___ XXXX:yyyy conffile +# where XXXX is a type, yyyy is text to be in title +# b) Inside sequence: ___ END ends the sequence (ignore rest of line) +# c) Inside sequence: # Documentation line +# d) Inside sequence: Anything else is command or config lines +# Conv.to XML: ">" "<" "&" and put all inside +# *) Anywhere ____xxxx Leading 4 underlines or more, always ignored +# unless one of the recognized XXXX +# *) Anywhere outside sequence, ignore all +# *) There can be multiple of each type of sequence in each README file +# with different yyyy + + +cat $BBTEMPLATE | awk ' + />SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE$BBXML + + +# Long command lines: The awk code below breaks too long lines, but this is not perfect. +extractcmds_filter() { + echo " " | tr -d '\n' + sed '/^___/d;s/\&/\&/g' | sed 's//\>/g;/^$/d' | \ + awk 'BEGIN { MAX=90; } + ( length($0) > MAX ) { + LINE=$0; + while (length(LINE) > MAX) { + if (index(LINE," ") == 0 ) { + print "ERROR: PROBLEM: No space in too long line:" LINE > "/dev/stderr"; + print $LINE; + next; + } + i=MAX; while ( substr(LINE,i,1) != " " ) { i=i-1; if (i==0) {break;} } + print substr(LINE,0,i) "\\"; + REST=substr(LINE,i+1); + if ( length(REST) == 0 ) { next ; } + LINE=" " REST; + } + if ( length(LINE) > 0 ) { print LINE; next ; } + } + { print;}' + echo "" +} + +extractcmds_for_type() { # target/README BOOTorBUILD + README=s_targets/"$1" + CMDTYPE="$2" + COMMANDSFOR=`egrep "___$CMDTYPE:" $README` + for CMDS in $COMMANDSFOR + do + cmdsfor=`echo "$CMDS" | sed 's/[^:]*://'` + echo " $CMDTYPE for $cmdsfor" + cat "$README" | sed -n "/$COMMANDSFOR/,/___END/p" | extractcmds_filter + done +} + +for targetreadme in $TARGETREADMES +do + TARGET=`dirname $targetreadme` + echo "" >>$BBXML + echo "
" >>$BBXML + echo " Target $TARGET - Build and Boot Instructions" >>$BBXML + echo " NOTE: DO NOT EDIT THIS GENERATED FILE! Only edit the template file." >>$BBXML + echo "
" >>$BBXML + echo " Build Instructions" >>$BBXML + extractcmds_for_type $targetreadme Build-command >>$BBXML + echo "
" >>$BBXML + echo "" >>$BBXML + echo "
" >>$BBXML + echo " Boot Instructions" >>$BBXML + extractcmds_for_type $targetreadme Boot-command >>$BBXML + echo "
" >>$BBXML + echo "
" >>$BBXML +done + +echo "" >>$BBXML +echo "Ready created $BBXML" -- cgit v1.2.3-54-g00ecf