summaryrefslogtreecommitdiffstats
path: root/doc/initbuildboot.sh
diff options
context:
space:
mode:
authorLennart Johansson <lennart.johansson@enea.com>2016-06-02 13:41:16 +0200
committerLennart Johansson <lennart.johansson@enea.com>2016-06-02 13:41:16 +0200
commit8decb3267be14596c377155d6bc84a0eb61f04e9 (patch)
tree48ce3df49e534a55457e6a06d88cfcab57eff1e5 /doc/initbuildboot.sh
parentac10f04eef9b8dfc5d38978f78f4bc6710ea7525 (diff)
downloadel_manifests-networking-8decb3267be14596c377155d6bc84a0eb61f04e9.tar.gz
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-<profile>.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 <lennart.johansson@enea.com>
Diffstat (limited to 'doc/initbuildboot.sh')
-rw-r--r--doc/initbuildboot.sh111
1 files changed, 111 insertions, 0 deletions
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 @@
1#!/bin/sh
2VER="R0.06"
3
4BBTEMPLATE=
5BBXML=
6
7USAGE="`basename $0` -xml buildbootxml-to-create -template templatexml-file ($VER)
8 Currently only supports sequence types Build-command: and Boot-command:
9 Both files should have path book-*release-info/doc/
10 Creates the XML file from the template, inserting build/boot commands
11 from the various s_targets/XXXtargetXXX/README files
12 at the place in template with >SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE<
13 ignoring rest of template
14 The code tries to fold too long lines, but this is not perfect. Best would
15 be if the command lines already in README are short enough, e.g. by
16 using short variables, which work both on shell and uboot command lines"
17
18while echo "x$1" | egrep '^x-' >/dev/null 2>&1
19do
20 OPT="$1" ; shift
21 if [ "$OPT" = "--help" -o "$OPT" = "-h" -o "$OPT" = "-help" ] ; then echo "$USAGE" ; exit ; fi
22 if [ "$OPT" = "-xml" ] ; then BBXML="$1" ; shift; fi
23 if [ "$OPT" = "-template" ] ; then BBTEMPLATE="$1" ; shift; fi
24done
25if [ "$BBTEMPLATE" = "" ]; then echo "ERROR: Missing option -template templatefile"; exit ; fi
26if [ "$BBXML" = "" ]; then echo "ERROR: Missing option -xml buildbootxml-to-create"; exit ; fi
27if [ ! -f "$BBTEMPLATE" ]; then echo "ERROR: Missing templatefile '$BBTEMPLATE'"; exit; fi
28if [ ! -d "`dirname \"$BBXML\"`" ]; then echo "ERROR: Missing parent directory for '$BBXML'"; exit ; fi
29
30echo "`basename $0` Creating $BBXML from"
31TARGETREADMES=`cd s_targets ; ls -d */README | tr '\n' ' '`
32echo " $TARGETREADMES"
33
34# README file formats:
35# a) Sequence starts: ___ XXXX:yyyy or ___ XXXX:yyyy conffile
36# where XXXX is a type, yyyy is text to be in title
37# b) Inside sequence: ___ END ends the sequence (ignore rest of line)
38# c) Inside sequence: # Documentation line
39# d) Inside sequence: Anything else is command or config lines
40# Conv.to XML: ">" "<" "&" and put all inside <programlisting>
41# *) Anywhere ____xxxx Leading 4 underlines or more, always ignored
42# unless one of the recognized XXXX
43# *) Anywhere outside sequence, ignore all
44# *) There can be multiple of each type of sequence in each README file
45# with different yyyy
46
47
48cat $BBTEMPLATE | awk '
49 />SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE</ {exit 0; }
50 { print $0; }
51' >$BBXML
52
53
54# Long command lines: The awk code below breaks too long lines, but this is not perfect.
55extractcmds_filter() {
56 echo " <programlisting>" | tr -d '\n'
57 sed '/^___/d;s/\&/\&amp;/g' | sed 's/</\&lt;/g;s/>/\&gt;/g;/^$/d' | \
58 awk 'BEGIN { MAX=90; }
59 ( length($0) > MAX ) {
60 LINE=$0;
61 while (length(LINE) > MAX) {
62 if (index(LINE," ") == 0 ) {
63 print "ERROR: PROBLEM: No space in too long line:" LINE > "/dev/stderr";
64 print $LINE;
65 next;
66 }
67 i=MAX; while ( substr(LINE,i,1) != " " ) { i=i-1; if (i==0) {break;} }
68 print substr(LINE,0,i) "\\";
69 REST=substr(LINE,i+1);
70 if ( length(REST) == 0 ) { next ; }
71 LINE=" " REST;
72 }
73 if ( length(LINE) > 0 ) { print LINE; next ; }
74 }
75 { print;}'
76 echo "</programlisting>"
77}
78
79extractcmds_for_type() { # target/README BOOTorBUILD
80 README=s_targets/"$1"
81 CMDTYPE="$2"
82 COMMANDSFOR=`egrep "___$CMDTYPE:" $README`
83 for CMDS in $COMMANDSFOR
84 do
85 cmdsfor=`echo "$CMDS" | sed 's/[^:]*://'`
86 echo " <para>$CMDTYPE for $cmdsfor</para>"
87 cat "$README" | sed -n "/$COMMANDSFOR/,/___END/p" | extractcmds_filter
88 done
89}
90
91for targetreadme in $TARGETREADMES
92do
93 TARGET=`dirname $targetreadme`
94 echo "" >>$BBXML
95 echo " <section id=\"target_$TARGET\">" >>$BBXML
96 echo " <title>Target $TARGET - Build and Boot Instructions</title>" >>$BBXML
97 echo " <remark>NOTE: DO NOT EDIT THIS GENERATED FILE! Only edit the template file.</remark>" >>$BBXML
98 echo " <section>" >>$BBXML
99 echo " <title>Build Instructions</title>" >>$BBXML
100 extractcmds_for_type $targetreadme Build-command >>$BBXML
101 echo " </section>" >>$BBXML
102 echo "" >>$BBXML
103 echo " <section>" >>$BBXML
104 echo " <title>Boot Instructions</title>" >>$BBXML
105 extractcmds_for_type $targetreadme Boot-command >>$BBXML
106 echo " </section>" >>$BBXML
107 echo " </section>" >>$BBXML
108done
109
110echo "</chapter>" >>$BBXML
111echo "Ready created $BBXML"