Changeset 642722f for BLFS/xsl


Ignore:
Timestamp:
03/26/2014 08:47:59 AM (10 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
2.4, ablfs-more, legacy, new_features, trunk
Children:
7d2dec4
Parents:
2ae5bbe
Message:

Improve script generation for BLFS tools:

  • introduce a template for downloading code
  • account for various layout of the BLFS pages for package information and additional

downloads

  • Add the possibility for addtional downloads in xorg pages
Location:
BLFS/xsl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BLFS/xsl/make_book.xsl

    r2ae5bbe r642722f  
    350350          </listitem>
    351351        </itemizedlist>
     352        <!-- If there is an additional download, we need to output that -->
     353        <xsl:if test=".//bridgehead[contains(string(),'Additional')]">
     354          <xsl:copy-of
     355                 select=".//bridgehead[contains(string(),'Additional')]"/>
     356          <xsl:copy-of
     357                 select=".//bridgehead[contains(string(),'Additional')]
     358                         /following-sibling::itemizedlist[1]"/>
     359        </xsl:if>
    352360      </sect2>
    353361      <sect2 role="installation">
  • BLFS/xsl/scripts.xsl

    r2ae5bbe r642722f  
    5757        <xsl:choose>
    5858          <!-- Package page -->
    59           <xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
    60                           @id = 'xorg7-data' or @id = 'xorg7-driver' or
    61                           @id = 'xorg7-font' or @id = 'xorg7-lib' or
    62                           @id = 'xorg7-proto' or @id = 'xorg7-util')">
    63             <!-- Variables -->
    64             <!-- These three lines  could be important if SRC_ARCHIVE,
    65                  FTP_SERVER and SRCDIR were not set in the environment.
    66                  But they are not tested for length or anything later,
    67                  so not needed
    68             <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
    69             <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
    70             <xsl:text>SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>-->
    71             <xsl:text>&#xA;PKG_DIR=</xsl:text>
     59          <xsl:when test="sect2[@role='package']">
     60            <!-- We build in a subdirectory -->
     61            <xsl:text>PKG_DIR=</xsl:text>
    7262            <xsl:value-of select="$filename"/>
    7363            <xsl:text>&#xA;</xsl:text>
     
    7565            <xsl:apply-templates select="sect2"/>
    7666            <!-- Clean-up -->
    77             <!-- xorg7-server used to require mesalib tree being present.
    78                  That is no more true
    79             <xsl:if test="not(@id='mesalib')"> -->
    80               <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
     67            <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
    8168            <!-- In some case, some files in the build tree are owned
    8269                 by root -->
    83               <xsl:if test="$sudo='y'">
    84                 <xsl:text>sudo </xsl:text>
    85               </xsl:if>
    86               <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
    87             <!-- Same reason as preceding comment
     70            <xsl:if test="$sudo='y'">
     71              <xsl:text>sudo </xsl:text>
    8872            </xsl:if>
    89             <xsl:if test="@id='xorg7-server'">
    90               <xsl:text>cd $SRC_DIR/MesaLib
    91 UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
    92 rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
    93             </xsl:if> -->
    94           </xsl:when>
    95           <!-- Xorg7 pseudo-packages -->
    96           <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
    97             <xsl:text># Useless SRC_DIR=$SRC_DIR
    98 
    99 cd $SRC_DIR
    100 mkdir -p xc
    101 cd xc&#xA;</xsl:text>
    102             <xsl:apply-templates select="sect2" mode="xorg7"/>
     73            <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
    10374          </xsl:when>
    10475          <!-- Non-package page -->
     
    11990        <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
    12091        <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
     92        <!-- Download information is in bridgehead tags -->
    12193        <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
    12294        <xsl:text>&#xA;</xsl:text>
     
    136108 unzip -d $UNPACKDIR ${PACKAGE}
    137109fi
    138 cd $UNPACKDIR&#xA;</xsl:text>
     110cd $UNPACKDIR&#xA;&#xA;</xsl:text>
    139111        <xsl:apply-templates select=".//screen | .//para/command"/>
    140112        <xsl:if test="$sudo = 'y'">
     
    149121  </xsl:template>
    150122
    151   <xsl:template match="sect2" mode="xorg7">
    152     <xsl:choose>
    153  <!--     <xsl:when test="@role = 'package'">
    154         <xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
    155       </xsl:when>-->
    156       <xsl:when test="not(@role)">
    157 <!-- This is the packages download instructions> -->
    158         <xsl:apply-templates select=".//screen" mode="xorg7"/>
    159       </xsl:when>
    160       <xsl:when test="@role = 'installation'">
    161         <xsl:apply-templates select=".//screen" mode="xorg7"/>
    162         <xsl:if test="$sudo = 'y'">
    163           <xsl:text>sudo /sbin/</xsl:text>
    164         </xsl:if>
    165         <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
    166       </xsl:when>
    167       <xsl:when test="@role = 'configuration'">
    168         <xsl:text>if [[ $XORG_PREFIX != /usr ]] ; then&#xA;</xsl:text>
    169         <xsl:apply-templates select=".//screen"/>
    170         <xsl:text>fi&#xA;</xsl:text>
    171       </xsl:when>
    172     </xsl:choose>
    173   </xsl:template>
    174 
    175123<!--==================== Download code =======================-->
    176124
     125  <!-- template for extracting the filename from an url in the form:
     126       proto://internet.name/dir1/.../dirn/filename?condition.
     127       Needed, because substring-after(...,'/') returns only the
     128       substring after the first '/'. -->
    177129  <xsl:template name="package_name">
    178130    <xsl:param name="url" select="foo"/>
     
    197149  </xsl:template>
    198150
    199   <xsl:template match="bridgehead">
    200     <xsl:choose>
    201       <xsl:when test="string()='Package Information'">
    202         <xsl:variable name="url">
     151  <!-- Generates the code to download a package, an additional package or
     152       a patch. -->
     153  <xsl:template name="download-file">
     154    <xsl:param name="httpurl" select="''"/>
     155    <xsl:param name="ftpurl" select="''"/>
     156    <xsl:param name="md5" select="''"/>
     157    <xsl:param name="varname" select="''"/>
     158    <xsl:variable name="package">
     159      <xsl:call-template name="package_name">
     160        <xsl:with-param name="url">
    203161          <xsl:choose>
    204             <xsl:when
    205               test="string-length(
    206                 following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
    207                     &gt; 10">
    208               <xsl:value-of select=
    209             "following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
     162            <xsl:when test="string-length($httpurl) &gt; 10">
     163              <xsl:value-of select="$httpurl"/>
    210164            </xsl:when>
    211165            <xsl:otherwise>
    212               <xsl:value-of select=
    213             "following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
     166              <xsl:value-of select="$ftpurl"/>
    214167            </xsl:otherwise>
    215168          </xsl:choose>
    216         </xsl:variable>
    217         <xsl:variable name="package">
    218           <xsl:call-template name="package_name">
    219             <xsl:with-param name="url" select="$url"/>
    220           </xsl:call-template>
    221         </xsl:variable>
    222         <xsl:variable
    223           name="first_letter"
    224           select="translate(substring($package,1,1),
    225                             'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    226                             'abcdefghijklmnopqrstuvwxyz')"/>
    227         <xsl:text>PACKAGE=</xsl:text>
    228         <xsl:value-of select="$package"/>
    229         <xsl:text>&#xA;if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
    230         <!-- SRC_ARCHIVE may have subdirectories or not -->
    231         <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
    232         <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE&#xA;</xsl:text>
    233         <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then&#xA;</xsl:text>
    234         <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA;  else&#xA;</xsl:text>
    235         <!-- The FTP_SERVER mirror -->
    236         <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
    237         <xsl:value-of select="$first_letter"/>
    238         <xsl:text>/$PACKAGE</xsl:text>
    239         <xsl:apply-templates
    240              select="following-sibling::itemizedlist[1]/listitem/para"
    241              mode="package"/>
    242       </xsl:when>
    243       <xsl:when test="contains(string(),'Additional')">
    244         <xsl:apply-templates
    245              select="following-sibling::itemizedlist[1]/listitem/para"
    246              mode="additional"/>
    247       </xsl:when>
    248       <xsl:otherwise/>
    249     </xsl:choose>
    250   </xsl:template>
    251 
    252   <xsl:template match="para" mode="package">
    253     <xsl:choose>
    254       <xsl:when test="contains(string(),'HTTP')">
    255         <!-- Upstream HTTP URL -->
    256         <xsl:if test="string-length(ulink/@url) &gt; '10'">
    257           <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
    258           <xsl:choose>
    259             <xsl:when test="contains(ulink/@url,'?')">
    260               <xsl:value-of select="substring-before(ulink/@url,'?')"/>
    261             </xsl:when>
    262             <xsl:otherwise>
    263               <xsl:value-of select="ulink/@url"/>
    264             </xsl:otherwise>
    265           </xsl:choose>
    266           <xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
    267             <xsl:text>
    268     cp $PACKAGE $SRC_ARCHIVE
     169        </xsl:with-param>
     170      </xsl:call-template>
     171    </xsl:variable>
     172    <xsl:variable name="first_letter"
     173                  select="translate(substring($package,1,1),
     174                                    'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
     175                                    'abcdefghijklmnopqrstuvwxyz')"/>
     176    <xsl:text>&#xA;</xsl:text>
     177    <xsl:value-of select="$varname"/>
     178    <xsl:text>=</xsl:text>
     179    <xsl:value-of select="$package"/>
     180    <xsl:text>&#xA;if [[ ! -f $</xsl:text>
     181    <xsl:value-of select="$varname"/>
     182    <xsl:text> ]] ; then&#xA;</xsl:text>
     183    <!-- SRC_ARCHIVE may have subdirectories or not -->
     184    <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
     185    <xsl:value-of select="$varname"/>
     186    <xsl:text> ]] ; then&#xA;</xsl:text>
     187    <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
     188    <xsl:value-of select="$varname"/>
     189    <xsl:text> $</xsl:text>
     190    <xsl:value-of select="$varname"/>
     191    <xsl:text>&#xA;</xsl:text>
     192    <xsl:text>  elif [[ -f $SRC_ARCHIVE/$</xsl:text>
     193    <xsl:value-of select="$varname"/>
     194    <xsl:text> ]] ; then&#xA;</xsl:text>
     195    <xsl:text>    cp $SRC_ARCHIVE/$</xsl:text>
     196    <xsl:value-of select="$varname"/>
     197    <xsl:text> $</xsl:text>
     198    <xsl:value-of select="$varname"/>
     199    <xsl:text>&#xA;  else&#xA;</xsl:text>
     200    <!-- The FTP_SERVER mirror -->
     201    <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
     202    <xsl:value-of select="$first_letter"/>
     203    <xsl:text>/$</xsl:text>
     204    <xsl:value-of select="$varname"/>
     205    <xsl:if test="string-length($httpurl) &gt; 10">
     206      <xsl:text> ||
     207    wget -T 30 -t 5 </xsl:text>
     208      <xsl:value-of select="$httpurl"/>
     209    </xsl:if>
     210    <xsl:if test="string-length($ftpurl) &gt; 10">
     211      <xsl:text> ||
     212    wget -T 30 -t 5 </xsl:text>
     213      <xsl:value-of select="$ftpurl"/>
     214    </xsl:if>
     215    <xsl:text>
     216    cp $</xsl:text>
     217    <xsl:value-of select="$varname"/>
     218    <xsl:text> $SRC_ARCHIVE
    269219  fi
    270220fi
    271221</xsl:text>
    272           </xsl:if>
    273         </xsl:if>
    274       </xsl:when>
    275       <xsl:when test="contains(string(),'FTP')">
    276         <!-- Upstream FTP URL -->
    277         <xsl:if test="string-length(ulink/@url) &gt; '10'">
    278           <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
    279           <xsl:value-of select="ulink/@url"/>
    280         </xsl:if>
    281         <xsl:text>
    282     cp $PACKAGE $SRC_ARCHIVE
    283   fi
    284 fi
     222    <xsl:if test="string-length($md5) &gt; 10">
     223      <xsl:text>echo "</xsl:text>
     224      <xsl:value-of select="$md5"/>
     225      <xsl:text>&#x20;&#x20;$</xsl:text>
     226      <xsl:value-of select="$varname"/>
     227      <xsl:text>" | md5sum -c -
    285228</xsl:text>
    286       </xsl:when>
    287       <xsl:when test="contains(string(),'MD5')">
    288 <!-- some md5 sums are written with a LF -->
    289         <xsl:variable name="md5">
    290           <xsl:choose>
    291             <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
    292               <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
    293             </xsl:when>
    294             <xsl:otherwise>
    295               <xsl:value-of select="substring-after(string(),'sum: ')"/>
    296             </xsl:otherwise>
    297           </xsl:choose>
    298         </xsl:variable>
    299         <xsl:text>echo "</xsl:text>
    300         <xsl:value-of select="$md5"/>
    301         <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
    302       </xsl:when>
     229    </xsl:if>
     230  </xsl:template>
     231
     232  <!-- Extract the MD5 sum information -->
     233  <xsl:template match="para" mode="md5">
     234    <xsl:choose>
     235      <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
     236        <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
     237      </xsl:when>
     238      <xsl:otherwise>
     239        <xsl:value-of select="substring-after(string(),'sum: ')"/>
     240      </xsl:otherwise>
    303241    </xsl:choose>
    304242  </xsl:template>
    305243
    306   <xsl:template match="para" mode="additional">
     244  <!-- We have several templates itemizedlist, depending on whether we
     245       expect the package information, or additional package(s) or patch(es)
     246       information. Select the appropriate mode here. -->
     247  <xsl:template match="bridgehead">
    307248    <xsl:choose>
    308       <xsl:when test="contains(string(ulink/@url),'.patch')">
    309         <xsl:variable name="patch">
    310           <xsl:call-template name="package_name">
    311             <xsl:with-param name="url" select="ulink/@url"/>
     249      <!-- Special case for Openjdk -->
     250      <xsl:when test="contains(string(),'Source Package Information')">
     251        <xsl:apply-templates
     252             select="following-sibling::itemizedlist[1]//simplelist">
     253          <xsl:with-param name="varname" select="'PACKAGE'"/>
     254        </xsl:apply-templates>
     255        <xsl:apply-templates select="following-sibling::itemizedlist
     256                             [preceding-sibling::bridgehead[1]=current()
     257                              and position() &gt;1]//simplelist">
     258          <xsl:with-param name="varname" select="'PACKAGE1'"/>
     259        </xsl:apply-templates>
     260      </xsl:when>
     261      <!-- Package information -->
     262      <xsl:when test="contains(string(),'Package Information')">
     263        <xsl:apply-templates select="following-sibling::itemizedlist
     264                             [preceding-sibling::bridgehead[1]=current()]"
     265                             mode="package"/>
     266      </xsl:when>
     267      <!-- Additional package information -->
     268      <xsl:when test="contains(string(),'Additional')">
     269        <xsl:apply-templates select="following-sibling::itemizedlist"
     270                             mode="additional"/>
     271      </xsl:when>
     272      <!-- Do not do anything if the dev has created another type of
     273           bridgehead. -->
     274      <xsl:otherwise/>
     275    </xsl:choose>
     276  </xsl:template>
     277
     278  <!-- Call the download code template with appropriate parameters -->
     279  <xsl:template match="itemizedlist" mode="package">
     280    <xsl:call-template name="download-file">
     281      <xsl:with-param name="httpurl">
     282        <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
     283      </xsl:with-param>
     284      <xsl:with-param name="ftpurl">
     285        <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
     286      </xsl:with-param>
     287      <xsl:with-param name="md5">
     288        <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
     289                             mode="md5"/>
     290      </xsl:with-param>
     291      <xsl:with-param name="varname" select="'PACKAGE'"/>
     292    </xsl:call-template>
     293  </xsl:template>
     294
     295  <xsl:template match="itemizedlist" mode="additional">
     296  <!-- The normal layout is "one listitem"<->"one url", but some devs
     297       find amusing to have FTP and/or MD5sum listitems, or to
     298       enclose the download information inside a simplelist tag... -->
     299    <xsl:for-each select="listitem[.//ulink]">
     300      <xsl:choose>
     301        <!-- hopefully, there was a HTTP line before -->
     302        <xsl:when test="contains(string(./para),'FTP')"/>
     303        <xsl:when test=".//simplelist">
     304          <xsl:apply-templates select=".//simplelist">
     305            <xsl:with-param name="varname" select="'PACKAGE1'"/>
     306          </xsl:apply-templates>
     307        </xsl:when>
     308        <xsl:otherwise>
     309          <xsl:call-template name="download-file">
     310            <xsl:with-param name="httpurl">
     311              <xsl:value-of select="./para/ulink/@url"/>
     312            </xsl:with-param>
     313            <xsl:with-param name="ftpurl">
     314              <xsl:value-of
     315                   select="following-sibling::listitem[1]/
     316                           para[contains(string(),'FTP')]/ulink/@url"/>
     317            </xsl:with-param>
     318            <xsl:with-param name="md5">
     319              <xsl:apply-templates
     320                   select="following-sibling::listitem[position()&lt;3]/
     321                           para[contains(string(),'MD5')]"
     322                   mode="md5"/>
     323            </xsl:with-param>
     324            <xsl:with-param name="varname">
     325              <xsl:choose>
     326                <xsl:when test="contains(./para/ulink/@url,'.patch')">
     327                  <xsl:text>PATCH</xsl:text>
     328                </xsl:when>
     329                <xsl:otherwise>
     330                  <xsl:text>PACKAGE1</xsl:text>
     331                </xsl:otherwise>
     332              </xsl:choose>
     333            </xsl:with-param>
    312334          </xsl:call-template>
    313         </xsl:variable>
    314         <xsl:text>PATCH=</xsl:text>
    315         <xsl:value-of select="$patch"/>
    316         <xsl:text>&#xA;if [[ ! -f $PATCH ]] ; then&#xA;</xsl:text>
    317          <!-- SRC_ARCHIVE may have subdirectories or not -->
    318         <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PATCH ]] ; then&#xA;</xsl:text>
    319         <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PATCH $PATCH&#xA;</xsl:text>
    320         <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PATCH ]] ; then&#xA;</xsl:text>
    321         <xsl:text>    cp $SRC_ARCHIVE/$PATCH $PATCH&#xA;  else&#xA;</xsl:text>
    322         <xsl:text>wget -T 30 -t 5 </xsl:text>
    323         <xsl:value-of select="ulink/@url"/>
    324         <xsl:text>&#xA;</xsl:text>
    325         <xsl:text>
    326     cp $PATCH $SRC_ARCHIVE
    327   fi
    328 fi
    329 </xsl:text>
    330       </xsl:when>
    331       <xsl:when test="ulink">
    332         <xsl:if test="string-length(ulink/@url) &gt; '10'">
    333           <xsl:variable name="package">
    334             <xsl:call-template name="package_name">
    335               <xsl:with-param name="url" select="ulink/@url"/>
    336             </xsl:call-template>
    337           </xsl:variable>
    338           <xsl:variable
    339             name="first_letter"
    340             select="translate(substring($package,1,1),
    341                               'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    342                               'abcdefghijklmnopqrstuvwxyz')"/>
    343           <xsl:text>PACKAGE1=</xsl:text>
    344           <xsl:value-of select="$package"/>
    345           <xsl:text>&#xA;if [[ ! -f $PACKAGE1 ]] ; then&#xA;</xsl:text>
    346           <!-- SRC_ARCHIVE may have subdirectories or not -->
    347           <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then&#xA;</xsl:text>
    348           <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1&#xA;</xsl:text>
    349           <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then&#xA;</xsl:text>
    350           <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1&#xA;  else&#xA;</xsl:text>
    351           <!-- The FTP_SERVER mirror -->
    352           <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
    353           <xsl:value-of select="$first_letter"/>
    354           <xsl:text>/$PACKAGE1</xsl:text>
    355           <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
    356           <xsl:value-of select="ulink/@url"/>
    357           <xsl:text>
    358     cp $PACKAGE1 $SRC_ARCHIVE
    359   fi
    360 fi
    361 </xsl:text>
    362         </xsl:if>
    363       </xsl:when>
    364       <xsl:when test="contains(string(),'MD5')">
    365 <!-- some md5 sums are written with a LF -->
    366         <xsl:variable name="md5">
    367           <xsl:choose>
    368             <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
    369               <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
    370             </xsl:when>
    371             <xsl:otherwise>
    372               <xsl:value-of select="substring-after(string(),'sum: ')"/>
    373             </xsl:otherwise>
    374           </xsl:choose>
    375         </xsl:variable>
    376         <xsl:text>echo "</xsl:text>
    377         <xsl:value-of select="$md5"/>
    378         <xsl:text>&#x20;&#x20;$PACKAGE1" | md5sum -c -&#xA;</xsl:text>
    379       </xsl:when>
    380     </xsl:choose>
    381   </xsl:template>
    382 
    383   <xsl:template match="itemizedlist/listitem/para" mode="xorg7">
    384     <xsl:if test="contains(string(ulink/@url),'.md5') or
    385                   contains(string(ulink/@url),'.wget')">
    386       <xsl:text>wget -T 30 -t 5 </xsl:text>
    387       <xsl:value-of select="ulink/@url"/>
    388       <xsl:text>&#xA;</xsl:text>
    389     </xsl:if>
    390   </xsl:template>
    391 
    392   <xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
    393     <xsl:if test="contains(string(ulink/@url),'.patch')">
    394       <xsl:text>wget -T 30 -t 5 </xsl:text>
    395       <xsl:value-of select="ulink/@url"/>
    396       <xsl:text>&#xA;</xsl:text>
    397     </xsl:if>
    398   </xsl:template>
    399 
     335        </xsl:otherwise>
     336      </xsl:choose>
     337    </xsl:for-each>
     338  </xsl:template>
     339
     340  <!-- the simplelist case. Hopefully, the layout is one member for
     341       url, one for md5 and others for various information, that we do not
     342       use -->
     343  <xsl:template match="simplelist">
     344    <xsl:param name="varname" select="'PACKAGE1'"/>
     345    <xsl:call-template name="download-file">
     346      <xsl:with-param name="httpurl" select=".//ulink/@url"/>
     347      <xsl:with-param name="md5">
     348        <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
     349      </xsl:with-param>
     350      <xsl:with-param name="varname" select="$varname"/>
     351    </xsl:call-template>
     352  </xsl:template>
    400353<!--======================== Commands code ==========================-->
    401354
     
    416369        </xsl:otherwise>
    417370      </xsl:choose>
    418       <xsl:text>&#xA;</xsl:text>
    419     </xsl:if>
    420   </xsl:template>
    421 
    422   <xsl:template match="screen" mode="xorg7">
    423     <xsl:if test="child::* = userinput and not(@role = 'nodump')">
    424       <xsl:apply-templates select="userinput" mode="xorg7"/>
    425371      <xsl:text>&#xA;</xsl:text>
    426372    </xsl:if>
     
    468414  </xsl:template>
    469415
    470   <xsl:template match="screen" mode="sect-ver">
    471     <xsl:text>section=</xsl:text>
    472     <xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &amp;')"/>
    473     <xsl:text>&#xA;sect_ver=</xsl:text>
    474     <xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
    475     <xsl:text>&#xA;</xsl:text>
    476   </xsl:template>
    477 
    478416  <xsl:template match="para/command">
    479417    <xsl:if test="(contains(string(),'test') or
     
    494432  </xsl:template>
    495433
    496   <xsl:template match="userinput" mode="xorg7">
    497     <xsl:apply-templates mode="xorg7"/>
    498   </xsl:template>
    499 
    500   <xsl:template match="text()" mode="xorg7">
    501     <xsl:call-template name="output-text">
    502       <xsl:with-param name="out-string" select="string()"/>
    503     </xsl:call-template>
    504   </xsl:template>
    505 
    506   <xsl:template name="output-text">
    507     <xsl:param name="out-string" select="''"/>
    508     <xsl:choose>
    509       <xsl:when test="contains($out-string,'bash -e')">
    510         <xsl:call-template name="output-text">
    511           <xsl:with-param name="out-string"
    512                           select="substring-before($out-string,'bash -e')"/>
    513         </xsl:call-template>
    514         <xsl:text># bash -e</xsl:text>
    515         <xsl:call-template name="output-text">
    516           <xsl:with-param name="out-string"
    517                           select="substring-after($out-string,'bash -e')"/>
    518         </xsl:call-template>
    519       </xsl:when>
    520       <xsl:when test="contains($out-string,'exit')">
    521         <xsl:call-template name="output-text">
    522           <xsl:with-param name="out-string"
    523                           select="substring-before($out-string,'exit')"/>
    524         </xsl:call-template>
    525         <xsl:text># exit</xsl:text>
    526         <xsl:call-template name="output-text">
    527           <xsl:with-param name="out-string"
    528                           select="substring-after($out-string,'exit')"/>
    529         </xsl:call-template>
    530       </xsl:when>
    531       <xsl:when test="contains($out-string,'mkdir')">
    532         <xsl:call-template name="output-text">
    533           <xsl:with-param name="out-string"
    534                           select="substring-before($out-string,'mkdir')"/>
    535         </xsl:call-template>
    536         <xsl:text>mkdir -p</xsl:text>
    537         <xsl:call-template name="output-text">
    538           <xsl:with-param name="out-string"
    539                           select="substring-after($out-string,'mkdir')"/>
    540         </xsl:call-template>
    541       </xsl:when>
    542        <xsl:when test="contains($out-string,'rm -r ')">
    543         <xsl:call-template name="output-text">
    544           <xsl:with-param name="out-string"
    545                           select="substring-before($out-string,'rm -r ')"/>
    546         </xsl:call-template>
    547         <xsl:text>rm -rf </xsl:text>
    548         <xsl:call-template name="output-text">
    549           <xsl:with-param name="out-string"
    550                           select="substring-after($out-string,'rm -r ')"/>
    551         </xsl:call-template>
    552       </xsl:when>
    553      <xsl:otherwise>
    554         <xsl:value-of select="$out-string"/>
    555       </xsl:otherwise>
    556     </xsl:choose>
    557   </xsl:template>
    558 
    559434  <xsl:template match="text()" mode="root">
    560435    <xsl:call-template name="output-root">
Note: See TracChangeset for help on using the changeset viewer.