r3724 - in jhalfs/trunk/common: . libs

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Sat Sep 21 11:52:02 PDT 2013


Author: pierre
Date: Sat Sep 21 11:52:02 2013
New Revision: 3724

Log:
Adapted host requirements checks for CLFS

Modified:
   jhalfs/trunk/common/hostreqs.xsl
   jhalfs/trunk/common/libs/func_check_version.sh

Modified: jhalfs/trunk/common/hostreqs.xsl
==============================================================================
--- jhalfs/trunk/common/hostreqs.xsl	Sat Sep 21 03:38:16 2013	(r3723)
+++ jhalfs/trunk/common/hostreqs.xsl	Sat Sep 21 11:52:02 2013	(r3724)
@@ -17,20 +17,62 @@
   </xsl:template>
 
   <xsl:template match="emphasis">
+<!-- We assume that what is emphasized is in the form:
+aa...aa-dccsaaa (a anything except @, - "dash", d digit,
+                 c anything except space, s space) 
+or
+aa...aasdccsaaa
+This means we have to replace digits with @, and look for '-@'
+or ' @' -->
+    <xsl:variable name="normalized-string"
+                  select="translate(normalize-space(string()),
+                                                    '0123456789',
+                                                    '@@@@@@@@@@')"/>
+    <xsl:variable name="begin-ver">
+      <xsl:choose>
+        <xsl:when test="contains($normalized-string,' @')">
+          <xsl:value-of select="string-length(substring-before($normalized-string,' @'))+1"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string-length(substring-before($normalized-string,'-@'))+1"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="remaining-part"
+                  select="substring($normalized-string,number($begin-ver)+1)"/>
+
+    <xsl:variable name="end-ver">
+      <xsl:choose>
+        <xsl:when test="contains($remaining-part,' ')">
+           <xsl:value-of
+             select="string-length(substring-before($remaining-part,' '))"/>
+        </xsl:when>
+        <xsl:otherwise>
+           <xsl:value-of
+             select="string-length($remaining-part)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
     <xsl:text>local MIN_</xsl:text>
     <xsl:choose>
-      <xsl:when test="contains(string(),' ')">
-        <xsl:value-of select=
-           "substring-before(substring-after(normalize-space(string()),
-                                             ' '),
-                             '-')"/>
+      <xsl:when test="contains(string(),'Kernel')">
+        <xsl:text>Linux</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(string(),'GLIBC')">
+        <xsl:text>Glibc</xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(string(),'XZ')">
+        <xsl:text>Xz</xsl:text>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:value-of select="substring-before(string(),'-')"/>
+<!-- We assume that there are no dash nor space in other names -->
+        <xsl:value-of select="substring(string(),1,number($begin-ver)-1)"/>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:text>_VER=</xsl:text>
-    <xsl:value-of select="substring-after(string(),'-')"/>
+    <xsl:value-of select="substring(string(),number($begin-ver)+1,$end-ver)"/>
     <xsl:text>
 </xsl:text>
   </xsl:template>

Modified: jhalfs/trunk/common/libs/func_check_version.sh
==============================================================================
--- jhalfs/trunk/common/libs/func_check_version.sh	Sat Sep 21 03:38:16 2013	(r3723)
+++ jhalfs/trunk/common/libs/func_check_version.sh	Sat Sep 21 11:52:02 2013	(r3724)
@@ -54,7 +54,7 @@
   echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
 
 #  echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
-  IFS=".-(pa"   # Split up w.x.y.z as well as w.x.y-rc  (catch release candidates)
+  IFS=".-(pab"   # Split up w.x.y.z as well as w.x.y-rc  (catch release candidates)
   set -- $ref_version # set positional parameters to minimum ver values
   ref_major=$1; ref_minor=$2; ref_revision=$3
   #
@@ -100,7 +100,7 @@
   export LC_ALL
 
   # LFS/HLFS/CLFS prerequisites
-  check_version "$MIN_Kernel_VER"    "`uname -r`"          "KERNEL"
+  check_version "$MIN_Linux_VER"     "`uname -r`"          "KERNEL"
   check_version "$MIN_Bash_VER"      "$BASH_VERSION"       "BASH"
   if [ ! -z $MIN_GCC_VER ]; then
     check_version "$MIN_GCC_VER"     "`gcc -dumpversion`"  "GCC"
@@ -128,10 +128,11 @@
   check_version "$MIN_Texinfo_VER"   "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
   check_version "$MIN_Xz_VER"        "$(xz --version | head -n1 | cut -d" " -f4)"         "XZ"
   # Check for minimum sudo version
+  if [ -z $MIN_Sudo_VER ]; then MIN_Sudo_VER=1.7.0; fi
   SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
   if [ -x $SUDO_LOC ]; then
     sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
-    check_version "1.7.0"  "${sudoVer}"      "SUDO"
+    check_version "$MIN_Sudo_VER"  "${sudoVer}"      "SUDO"
   else
     echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
     exit 1



More information about the alfs-log mailing list