From 70919fc0a582f58aeac67863f5e0f5c232613f72 Mon Sep 17 00:00:00 2001 From: Lennart Johansson Date: Thu, 2 Jun 2016 13:41:04 +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/Makefile | 60 +++++++---- .../doc/book.xml | 2 +- doc/book-enea-linux-open-source/doc/about.xml | 2 +- .../doc/about_release.xml | 6 +- doc/book-enea-linux-release-info/doc/book.xml | 1 + .../doc/build_boot_template.xml | 26 +++++ .../doc/supported_features.xml | 2 +- .../doc/targetscontain.xml | 8 +- .../doc/targetscontain_template.xml | 7 +- doc/initbuildboot.sh | 111 +++++++++++++++++++++ 10 files changed, 197 insertions(+), 28 deletions(-) create mode 100644 doc/book-enea-linux-release-info/doc/build_boot_template.xml create mode 100644 doc/initbuildboot.sh (limited to 'doc') diff --git a/doc/Makefile b/doc/Makefile index 7fd9b52..59d25d5 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -20,8 +20,10 @@ TARGETDEFAULTXMLS := $(shell cd $(REPODIR); ls -1 */default.xml) # URL and HASH of this manifest repository to be used by the repo tool CURRENTHASH := $(shell git log -1 --pretty=format:%H 2>/dev/null) CURRENTURL := $(shell git remote show origin | sed -n '/Fetch URL: /s/^.*URL: //p' 2>/dev/null) -.PHONY: inittargets -# ****************************************************************** + +# ******************* AutoGenerated chapter from template and target READMEs ******* +BUILDBOOT_XML := book-enea-linux-release-info/doc/build_boot_generated.xml +BUILDBOOT_TEMPLATE := book-enea-linux-release-info/doc/build_boot_template.xml @@ -38,11 +40,10 @@ DOCBOOK_FO_USEFOP ?= yes DOCBOOK_TO_BOOKDIR ?= yes DOCBOOK_CLEANTMP ?= yes -#Components in this subsystem -COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source -# COMPONENTS += book-enea-linux-eclipse-open-source -# COMPONENTS += book-enea-linux-target-guide - +#Components (books) in this subsystem +# COMPONENTS := book-enea-linux-release-info book-enea-linux-open-source +# COMPONENTS += book-enea-linux-eclipse-open-source +COMPONENTS := $(shell ls -d book-enea* ) # -------------------------------------------------------------- ifeq ($(VERBOSE),yes) @@ -65,24 +66,23 @@ VALIDATE = no # Export all parameters including those on the command line export -.PHONY: doc books docusage +.PHONY: doc books docusage init initbuild inittargets initpardoc initbuildboot docusage: @echo 'make docusage #Shows this help text' @echo ' DOCBOOK_TOOLS_VERSIONS=yes #Displays DocBook tools versions in this machine' @echo 'make doc #Builds the userdoc, does autoinit if needed' - @echo 'make init #Init all needed s_* below' + @echo 'make init #Init all needed init* below' @echo 'make initbuild #Init s_docbuild Docbook build system and central files' @echo 'make inittargets #Init s_targets using repo tool Targets in this distro with poky' @echo 'make initpardoc #Init s_docsrc_common using info from poky/' + @echo 'make initbuildboot #Init build_boot chapter from READMEs and template in release info' @echo ' DOCBOOK_CLEANTMP=no #Option to keep temp files in doc/ and tmp/' @echo ' BOOK_GLOBALCLONEROOT=yes #Option for all init above to clone all outside the doc directory' @echo ' BOOK_GLOBALCLONEROOT=otherpath #Option for all init above to clone all' - @echo #Force rebuilding (ignore dependency on file times or BL_LABEL)' - @echo ' # Dependency only works if common doc directory is kept' @echo 'make pullbuild #git pull in s_docbuild' - @echo 'make pulltargets #git pull in s_targets' + @echo 'make pulltargets #git pull in s_targets. You need also initpardoc initbuildboot' @echo 'make clean #Clean. Also clean s_* but not any external clones' @echo '' @echo 'Optional parameters for make doc:' @@ -105,7 +105,7 @@ docusage: @echo ' DOCBOOK_OLINK_TARGETDB=only #Build a target db for this book (for links into it)' @echo ' DOCBOOK_OLINK_TARGETDB=yes #Build a target db AND build the book' @echo ' #Master olinkdb defined in this Makefile, one per generated format, is:' - @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' + @echo ' $(DOCBOOKOLINKDB_BASE)_*.db' @echo ' Typical examples:' @echo ' make doc Creates all books, all formats' @echo ' make doc COMP=book-xxxx FORMAT=html' @@ -124,7 +124,8 @@ ifeq ($(DOCBOOK_TOOLS_VERSIONS),yes) $(VERB)$(MAKE) -f $(DOCBOOKMAKE)/tools_book_standalone.mk book_tools_versions endif -init: initbuild inittargets initpardoc +# We rely on make doing these in order left to right +init: initbuild inittargets initpardoc initbuildboot pullall: pullbuild pulltargets # If no COMP, iterate over books-* in COMPONENTS with make doc @@ -150,7 +151,7 @@ FORMAT=html pdf eclipse endif -books: initbuild inittargets initpardoc +books: init # BOOKPACKAGES is defined in all book-*/swcomp.mk $(VERB)DISTRO_VERSION_MAJOR=`egrep '"EneaLinux_DISTRO_VERSION_MAJOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*//;s/<\/phrase>.*//'` ; \ DISTRO_VERSION_MINOR=`egrep '"EneaLinux_DISTRO_VERSION_MINOR"' s_docsrc_common/pardoc-distro.xml | sed 's/.*//;s/<\/phrase>.*//'` ; \ @@ -169,8 +170,8 @@ ifeq ($(DOCBOOK_CLEANTMP),yes) endif endif -# cleaninit cleans ALL tmpcommon and all s_* -clean: cleaninit +# cleaninit cleans ALL tmpcommon and all s_* and generated build_boot chapter xml +clean: cleaninit cleanbuildboot $(VERB)rm -rf doc tmp 2>/dev/null ifneq ($(filter book-%, $(COMPONENTS)),) $(VERB)for comp in $(filter book-%, $(COMPONENTS)); do \ @@ -214,12 +215,12 @@ $(TMPCLONEROOT_TARGETS): # **************************************************************************** # ******************** SUPPORT FOR dynamic pardoc with added parameters ****** +# pardoc-distro can contain MAJOR.MINOR-xxxxx keeping -xxxx when replacing MINOR.MINOR from enea.conf PATH_DOCSRC_COMMON = $(SUBSYSROOT)/s_docsrc_common NAME_DOCSRC_COMMON = docsrc_common TMPCLONEROOT_DOCSRC_COMMON := $(TMPCLONEROOT)/$(NAME_DOCSRC_COMMON) TMPPARDOC := $(TMPCLONEROOT_DOCSRC_COMMON)/pardoc-distro.xml -.PHONY: initpardoc initpardoc: s_docsrc_common @@ -233,14 +234,33 @@ $(TMPCLONEROOT_DOCSRC_COMMON): s_targets $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi $(VERB)if [ ! -d $(TMPCLONEROOT_DOCSRC_COMMON) ]; then mkdir -p $(TMPCLONEROOT_DOCSRC_COMMON) ; fi @echo "Copy and patch docsrc_common/ files to $(TMPCLONEROOT_DOCSRC_COMMON)" - $(VERB)FIRSTTARGET=`ls -1 s_targets/ | head -1`; echo "FIRSTTARGET is $$FIRSTTARGET" ; \ + $(VERB)FIRSTTARGET=`ls -1 s_targets/ | head -1`; \ ENEACONF=s_targets/$$FIRSTTARGET/poky/meta-el-common/conf/distro/enea.conf ; \ DISTRO_VERSION_MAJOR=`egrep '^DISTRO_VERSION_MAJOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ DISTRO_VERSION_MINOR=`egrep '^DISTRO_VERSION_MINOR' $$ENEACONF | sed 's/^[^"]*"//;s/".*//'` ; \ cat docsrc_common/pardoc-distro.xml | sed '/<\/section>/d' | \ - sed '/$(TMPPARDOC) ; \ + sed '/$(TMPPARDOC) ; \ echo "$$DISTRO_VERSION_MAJOR" >>$(TMPPARDOC) ; \ echo "$$DISTRO_VERSION_MINOR" >>$(TMPPARDOC) ; \ echo "" >>$(TMPPARDOC) # **************************************************************************** +# ***** Create XML chapter with build/boot commands from all README files in s_targets + +initbuildboot: $(BUILDBOOT_XML) + +cleanbuildboot: + $(VERB)rm -f $(BUILDBOOT_XML) 2>/dev/null + + +$(BUILDBOOT_XML): s_targets $(BUILDBOOT_TEMPLATE) + @echo "Creating $(BUILDBOOT_XML) from READMEs" + $(VERB)INITBB_CMD=initbuildboot.sh ; \ + if [ -f "$$INITBB_CMD" ]; then \ + sh "$$INITBB_CMD" -xml $(BUILDBOOT_XML) -template $(BUILDBOOT_TEMPLATE) ; \ + else \ + echo "ERROR: Missing $$INITBB_CMD, can not create $(BUILDBOOT_XML)"; exit 10; \ + fi + +# **************************************************************************** diff --git a/doc/book-enea-linux-eclipse-open-source/doc/book.xml b/doc/book-enea-linux-eclipse-open-source/doc/book.xml index a25a7de..b76e105 100644 --- a/doc/book-enea-linux-eclipse-open-source/doc/book.xml +++ b/doc/book-enea-linux-eclipse-open-source/doc/book.xml @@ -8,7 +8,7 @@ Source Report Release Version diff --git a/doc/book-enea-linux-open-source/doc/about.xml b/doc/book-enea-linux-open-source/doc/about.xml index cd5be36..f2f863f 100644 --- a/doc/book-enea-linux-open-source/doc/about.xml +++ b/doc/book-enea-linux-open-source/doc/about.xml @@ -6,7 +6,7 @@ This document contains the open source and license information pertaining to packages provided with Enea Linux . \ No newline at end of file diff --git a/doc/book-enea-linux-release-info/doc/about_release.xml b/doc/book-enea-linux-release-info/doc/about_release.xml index d60a10c..90bedaa 100644 --- a/doc/book-enea-linux-release-info/doc/about_release.xml +++ b/doc/book-enea-linux-release-info/doc/about_release.xml @@ -55,7 +55,7 @@ - Freescale P2041DS, Power architecture, No DSPs, Quad-core QorIQ + Freescale P2041RDB, Power architecture, No DSPs, Quad-core QorIQ P2041 processor, e500mc cores. @@ -137,7 +137,7 @@ Distribution channel: All deliverables can be downloaded from QUEST REMOVE???? This is still in pardoc-distro.xml @@ -195,7 +195,7 @@ Packages provided by Yocto See the Yocto "Release Notes" diff --git a/doc/book-enea-linux-release-info/doc/book.xml b/doc/book-enea-linux-release-info/doc/book.xml index cc5788f..2be87b0 100644 --- a/doc/book-enea-linux-release-info/doc/book.xml +++ b/doc/book-enea-linux-release-info/doc/book.xml @@ -10,6 +10,7 @@ + diff --git a/doc/book-enea-linux-release-info/doc/build_boot_template.xml b/doc/book-enea-linux-release-info/doc/build_boot_template.xml new file mode 100644 index 0000000..709e624 --- /dev/null +++ b/doc/book-enea-linux-release-info/doc/build_boot_template.xml @@ -0,0 +1,26 @@ + + + + Target Specific Build and Boot Instructions + + For each target, a README file contains the build and boot + instructions. To make it easier for the reader, the contents of these + build/boot instruction have been extracted below into this release + information document. + + The README files are parts of the distribution and can be seen after + the distribution is fetched.NOTE: Only EDIT THE TEMPLATE FILE! A new + build_boot.xml file is created from the template and sections are added + below automatically from the README files for each target when building the + book! Only in the template file you see a line below with SCRIPT_...._HERE + and the text telling that this is a template file. + + SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE + + This is a template file which you can edit. When + the book is built, a new XML chapter file is created where the above part of + this file is copied to the new XML file and all from the line above is + replaced automatically by build and boot sections from the README + files! + \ No newline at end of file diff --git a/doc/book-enea-linux-release-info/doc/supported_features.xml b/doc/book-enea-linux-release-info/doc/supported_features.xml index 11e49b1..ebc4b59 100644 --- a/doc/book-enea-linux-release-info/doc/supported_features.xml +++ b/doc/book-enea-linux-release-info/doc/supported_features.xml @@ -6,7 +6,7 @@ The basic features provided by Yocto are listed on the "Features" tab on the ???? FIXME THIS WAS "ULINK_YOCTO_DOWN_MINOR_URL" in previous pardoc-distro file - I don't know what is shall be now. Perhaps it is Yocto release notes which I have changed this to, as found in poky.ent. diff --git a/doc/book-enea-linux-release-info/doc/targetscontain.xml b/doc/book-enea-linux-release-info/doc/targetscontain.xml index 06ec23d..42522ae 100644 --- a/doc/book-enea-linux-release-info/doc/targetscontain.xml +++ b/doc/book-enea-linux-release-info/doc/targetscontain.xml @@ -2,7 +2,13 @@
- Poky Components in this Distribution + DEMO-Autogenerated chapter - Poky Components in this + Distribution + + + JUST A DEMO, Examples what could be autoextracted from poky if we + want to +
Various Config Files extracted from ls1021atwr/poky diff --git a/doc/book-enea-linux-release-info/doc/targetscontain_template.xml b/doc/book-enea-linux-release-info/doc/targetscontain_template.xml index ea29af5..b91350b 100644 --- a/doc/book-enea-linux-release-info/doc/targetscontain_template.xml +++ b/doc/book-enea-linux-release-info/doc/targetscontain_template.xml @@ -2,6 +2,11 @@
- Poky Components in this Distribution + DEMO-Autogenerated chapter - Poky Components in this + Distribution + + JUST A DEMO, Examples what could be autoextracted from poky if we + want to +
\ No newline at end of file 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