jhalfs for merged sysv-systemd

Bruce Dubbs bruce.dubbs at gmail.com
Thu May 26 18:01:01 PDT 2016


Pierre Labastie wrote:
> On 26/05/2016 21:53, Bruce Dubbs wrote:
>> Pierre Labastie wrote:
>>> I've received a private message from Bruce about the adaptation of jhalfs
>>> to the upcoming merged sysv-systemd books.
>>> I think it is better to start a public thread. But I wait for his approval
>>> for publishing his message.
>>>
>>> I do not have much time today, but I'll try to look at Bruce's patch
>>> later. But please, to anybody who would like to contribute the code, may I
>>> suggest you produce patches against the most recent version (r3861 fixed
>>> the hostreqs.xml move problem)?
>>
>> I have no objection to putting my patch here, but it is broken.  I'll be
>> working on it today.  When I come up with a better one I'll post it here.
>>
>
> The problem is with the VERSION variable in jhalfs. We used to have only one
> line with "subtitle" in bookinfo.xml, but now with have two (one for each
> revision). And it needs some bash/sed/grep skill to extract only one version...
>
> It is getting late here, and I'll try to work on it tomorrow, unless you beat
> me on this.

Well it is late there tonight, but mid evening for me.  Here is my latest. 
  I fixed VERSION in two places.

Tho old version tried to figure out VERSION from bookinfo.xml by running 
xmllint, but the new version has two different copies if version 
differentiated bu a revision="sysd|systemd" attribute.  The file would 
need to be run through xsltproc profile.xml process first.  The easier way 
is to just go directly to the original source, general.ent.

That change needed to be in two files: common/libs/func_book_parser and 
jhalfs.

The new process works and I'm testing the build right now.  My first test 
failed because I had a typo in the book's sources.  I'll report back on 
this only if the test fails.

   -- Bruce

-------------- next part --------------
Index: Config.in
===================================================================
--- Config.in	(revision 3861)
+++ Config.in	(working copy)
@@ -8,8 +8,11 @@
 			#-- Select the BOOK/Build style you wish to configure.
 
 		config	BOOK_LFS
-			bool "Linux From Scratch"
+			bool "Linux From Scratch sysv"
 
+		config	BOOK_LFS_SYSD
+			bool "Linux From Scratch systemd"
+
 		config	BOOK_CLFS
 			bool "Cross-Compiled Linux From Scratch"
 
@@ -23,9 +26,14 @@
 #			bool "Hardened Linux From Scratch"
 	endchoice
 
+   config REV
+      string
+      default  "sysv"    if BOOK_LFS
+      default  "systemd" if BOOK_LFS_SYSD
+
 	config	PROGNAME
 		string
-		default	"lfs"		if BOOK_LFS
+		default	"lfs"		   if BOOK_LFS || BOOK_LFS_SYSD
 		default	"clfs"		if BOOK_CLFS
 		default	"clfs2"		if BOOK_CLFS2
 		default	"clfs3"		if BOOK_CLFS3
@@ -39,11 +47,11 @@
 	#--- Book version
 	choice
 		prompt	"Release"
-		default	relSVN	if BOOK_LFS || BOOK_HLFS
+		default	relSVN	if BOOK_LFS || BOOK_HLFS || BOOK_LFS_SYSD
 		default	relGIT	if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3
 		config	relSVN
 			bool	"SVN"
-			depends on BOOK_LFS || BOOK_HLFS
+			depends on BOOK_LFS || BOOK_HLFS || BOOK_LFS_SYSD
 			help
 				#-- Current development version as in trunk
 
@@ -624,7 +632,7 @@
 
 	config	DEF_USER
 		string
-		default	"lfs"	if BOOK_LFS
+		default	"lfs"	if BOOK_LFS || BOOK_LFS_SYSD
 		default	"clfs"	if BOOK_CLFS || BOOK_CLFS2 || BOOK_CLFS3
 		default "hlfs"	if BOOK_HLFS
 
@@ -817,7 +825,7 @@
 	#--- Package Management
 	config  PKGMNGT
 		bool    "Package management"
-		depends BOOK_LFS
+		depends BOOK_LFS || BOOK_LFS_SYSD
 		default n
 		help
 			#-- Use package management
Index: common/libs/func_book_parser
===================================================================
--- common/libs/func_book_parser	(revision 3861)
+++ common/libs/func_book_parser	(working copy)
@@ -23,9 +23,11 @@
     # Grab a fresh book if it's missing, otherwise, update it from the
     # repo. If we've already extracted the commands, move on to getting the
     # sources.
-    if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
+    if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && 
+       [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
         svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
-    elif [ $PROGNAME == "clfs" ]  || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
+    elif [ $PROGNAME == "clfs" ]  || [ $PROGNAME == "clfs2" ] || 
+         [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
         echo $TREE
         git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
         if [ ! $TREE == "development" ]; then
@@ -60,6 +62,13 @@
   case $PROGNAME in
     clfs*)
       VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
+    lfs)
+      if [[ "$REV" = "sysv" ]] ; then
+        VERSION=$(grep 'ENTITY version ' /$BOOK/general.ent| cut -d\" -f2)
+      else
+        VERSION=$(grep 'ENTITY versiond' /$BOOK/general.ent| cut -d\" -f2)
+      fi
+      ;;
     *)
       VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
   esac
@@ -84,7 +93,9 @@
                  --stringparam sparc $SPARC64_PROC \
                  --stringparam x86 $TARGET \
                  --stringparam mips $TARGET \
-                 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
+                 -o ./${PROGNAME}-commands/ \
+                 $XSL \
+                 $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
       ;;
 
     clfs2)
@@ -131,17 +142,28 @@
           bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
         fi
         popd > /dev/null
+
+        xsltproc --nonet                               \
+                 --xinclude                            \
+                 --output /tmp/lfs-html.xml            \
+                 --stringparam profile.revision $REV   \
+                 $BOOK/stylesheets/lfs-xsl/profile.xsl \
+                 $BOOK/index.xml
+
         xsltproc --nonet \
-                 --xinclude \
-                 --stringparam testsuite $TEST \
-                 --stringparam bomb-testsuite $BOMB_TEST \
-                 --stringparam vim-lang $VIMLANG \
-                 --stringparam full-locale $FULL_LOCALE \
-                 --stringparam timezone $TIMEZONE \
-                 --stringparam page $PAGE \
-                 --stringparam lang $LANG \
-                 --stringparam pkgmngt $PKGMNGT \
-                 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
+                 --stringparam testsuite      $TEST        \
+                 --stringparam bomb-testsuite $BOMB_TEST   \
+                 --stringparam vim-lang       $VIMLANG     \
+                 --stringparam full-locale    $FULL_LOCALE \
+                 --stringparam timezone       $TIMEZONE    \
+                 --stringparam page           $PAGE        \
+                 --stringparam lang           $LANG        \
+                 --stringparam pkgmngt        $PKGMNGT     \
+                 -o ./${PROGNAME}-commands/                \
+                 $XSL                                      \
+                 /tmp/lfs-html.xml >>$LOGDIR/$LOG 2>&1
+
+         rm -f /tmp/lfs-html.xml
       ;;
     *)  echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
         exit 1 ;;
Index: jhalfs
===================================================================
--- jhalfs	(revision 3861)
+++ jhalfs	(working copy)
@@ -434,6 +434,7 @@
 
 fi
 
+
 # When regenerating the Makefile, we need to know also the
 # canonical book version
 if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
@@ -440,8 +441,15 @@
   case $PROGNAME in
     clfs* )
       VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
+    lfs)
+      if [[ "$REV" = "sysv" ]] ; then
+        VERSION=$(grep 'ENTITY version ' /$BOOK/general.ent| cut -d\" -f2)
+      else
+        VERSION=$(grep 'ENTITY versiond' /$BOOK/general.ent| cut -d\" -f2)
+      fi
+      ;;
     *)
-      VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
+      VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | grep $REV | sed -e 's/^.*ion //'  -e 's/<\/.*//')  
   esac
 fi
 


More information about the alfs-discuss mailing list