On 27/05/2016 14:23, Pierre Labastie wrote:
On 27/05/2016 03:01, Bruce Dubbs wrote:
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.

Thanks,

This will need some testing: currently, I am building the book with the sysv merged version. Next, the systemd version, then, old version without merged books. But I am confident it should work with little or no modification. The patch does not address the selection of packages to download. I'll commit when I am done with all of that (depending on the level of confidence into the patch, I may create a new branch).

Pierre

Forgot to rediff after a typo fix... Here is the actualised version. Please discard the preceding message.
Index: jhalfs/Config.in
===================================================================
--- jhalfs.orig/Config.in
+++ jhalfs/Config.in
@@ -8,7 +8,10 @@ menu "--- BOOK Settings"
 			#-- Select the BOOK/Build style you wish to configure.
 
 		config	BOOK_LFS
-			bool "Linux From Scratch"
+			bool "Linux From Scratch sys V"
+
+		config	BOOK_LFS_SYSD
+			bool "Linux From Scratch systemd"
 
 		config	BOOK_CLFS
 			bool "Cross-Compiled Linux From Scratch"
@@ -23,9 +26,14 @@ menu "--- BOOK Settings"
 #			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 @@ menu "--- BOOK Settings"
 	#--- 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 @@ menu "--- General Settings"
 
 	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 @@ menu "--- Build Settings"
 	#--- Package Management
 	config  PKGMNGT
 		bool    "Package management"
-		depends BOOK_LFS
+		depends BOOK_LFS || BOOK_LFS_SYSD
 		default n
 		help
 			#-- Use package management
Index: jhalfs/common/libs/func_book_parser
===================================================================
--- jhalfs.orig/common/libs/func_book_parser
+++ jhalfs/common/libs/func_book_parser
@@ -23,9 +23,11 @@ get_book() {                 #
     # 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 @@ extract_commands() {         #
   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 @@ extract_commands() {         #
                  --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,26 @@ extract_commands() {         #
           bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
         fi
         popd > /dev/null
-        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
+
+        xsltproc --nonet                               \
+                 --xinclude                            \
+                 --output /tmp/lfs-full.xml            \
+                 --stringparam profile.revision $REV   \
+                 $BOOK/stylesheets/lfs-xsl/profile.xsl \
+                 $BOOK/index.xml
+
+        xsltproc --nonet                                   \
+                 --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     \
+                 --output ./${PROGNAME}-commands/          \
+                 $XSL                                      \
+                 /tmp/lfs-full.xml >>$LOGDIR/$LOG 2>&1
       ;;
     *)  echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
         exit 1 ;;
Index: jhalfs/jhalfs
===================================================================
--- jhalfs.orig/jhalfs
+++ jhalfs/jhalfs
@@ -440,8 +440,15 @@ if [[ "$REBUILD_MAKEFILE" = "y" ]] ; the
   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 ' $JHALFSDIR/$BOOK/general.ent| cut -d\" -f2)
+      else
+        VERSION=$(grep 'ENTITY versiond' $JHALFSDIR/$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 | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
   esac
 fi
 
Index: jhalfs/common/urls.xsl
===================================================================
--- jhalfs.orig/common/urls.xsl
+++ jhalfs/common/urls.xsl
@@ -14,16 +14,20 @@
   <xsl:param name="family">lfs</xsl:param>
 
   <!-- The libc model used for HLFS -->
-  <xsl:param name="model" select="glibc"/>
+  <xsl:param name="model" select="'glibc'"/>
 
   <!-- The kernel series used for HLFS -->
-  <xsl:param name="kernel" select="2.6"/>
+  <xsl:param name="kernel" select="'2.6'"/>
 
   <!-- Do we use a package manager? -->
-  <xsl:param name="pkgmngt" select="n"/>
+  <xsl:param name="pkgmngt" select="'n'"/>
+
+  <!-- The system for LFS: sysv of systemd -->
+  <xsl:param name="revision" select="'sysv'"/>
 
   <xsl:template match="/">
-    <xsl:apply-templates select="//ulink"/>
+    <xsl:apply-templates select="//varlistentry[@revision=$revision
+                                                or not(@revision)]//ulink"/>
     <xsl:if test="$pkgmngt='y'">
       <xsl:apply-templates
         select="document('packageManager.xml')//ulink"/>
Index: jhalfs/common/libs/func_download_pkgs
===================================================================
--- jhalfs.orig/common/libs/func_download_pkgs
+++ jhalfs/common/libs/func_download_pkgs
@@ -170,11 +170,13 @@ create_urls() {              #
       ;;
     lfs)
         echo -n "Creating LFS specific URLs file"
-        xsltproc --nonet --xinclude \
-                 --stringparam server $SERVER \
-                 --stringparam family lfs \
+        xsltproc --nonet --xinclude             \
+                 --stringparam server $SERVER   \
+                 --stringparam family lfs       \
                  --stringparam pkgmngt $PKGMNGT \
-                 -o ../sources/urls.lst urls.xsl \
+                 --stringparam revision $REV    \
+                 --output ../sources/urls.lst   \
+                 urls.xsl                       \
                  $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
         echo " ...OK"
       ;;
Index: jhalfs/common/libs/func_validate_configs.sh
===================================================================
--- jhalfs.orig/common/libs/func_validate_configs.sh
+++ jhalfs/common/libs/func_validate_configs.sh
@@ -31,7 +31,7 @@ inline_doc
   local -r ADVANCED_common="REPORT REBUILD_MAKEFILE"
 
   # BOOK Settings by book
-  local -r   LFS_book="$BOOK_common BLFS_TOOL"
+  local -r   LFS_book="$BOOK_common REV BLFS_TOOL"
   #local -r HLFS_added="SET_SSP SET_ASLR SET_PAX SET_HARDENED_TMP SET_WARNINGS \
   #                     SET_MISC SET_BLOWFISH"
   local -r HLFS_added=""
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to