Changeset 2758d94 for LFS/lfs.xsl


Ignore:
Timestamp:
04/11/2019 07:40:50 AM (5 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
0e4ddfa
Parents:
adbd09b
Message:

Use sect1info for getting informations on LFS packages:

  • add sect1info sections to packagemanager.xml.xxx + various fixes
  • add templates in LFS/lfs.xsl for script start and script end:
    • script start: define variables containing package information

print disk usage
unpack and change dir

  • script end: print disk usage

remove build dir

  • remove the corresponding operations from master.sh
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    radbd09b r2758d94  
    8484  <xsl:param name='local'     select="'n'"/>
    8585  <xsl:param name='log-level' select="'4'"/>
     86
     87  <!-- The scripts root is needed for printing disk usage -->
     88  <xsl:param name='script-root' select="'jhalfs'"/>
    8689
    8790<!-- End parameters -->
     
    170173      <xsl:text>&#xA;</xsl:text>
    171174      <xsl:if test="sect2[@role='installation']">
    172         <xsl:text>cd $PKGDIR&#xA;</xsl:text>
     175        <xsl:call-template name="start-script">
     176          <xsl:with-param name="order" select="$order"/>
     177        </xsl:call-template>
    173178      </xsl:if>
    174179      <xsl:apply-templates select="sect2[not(@revision) or
     
    193198      </xsl:if>
    194199      <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
     200      <xsl:if test="sect2[@role='installation']">
     201        <xsl:call-template name="end-script"/>
     202      </xsl:if>
    195203      <xsl:text>exit&#xA;</xsl:text>
    196204    </exsl:document>
     
    226234          <xsl:text>mkdir -pv $PKG_DEST/{bin,boot,etc,lib,sbin}
    227235mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin}
    228 mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
     236mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions}
    229237mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
    230238case $(uname -m) in
     
    296304<!-- remove empty directories -->
    297305          <xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \
    298            $PKG_DEST/usr/share/{doc,info,man} \
     306           $PKG_DEST/usr/share/bash-completion{/completions,} \
     307           $PKG_DEST/usr/share/{doc,info,man,} \
    299308           $PKG_DEST/usr/lib/pkgconfig \
    300309           $PKG_DEST/usr/{lib,bin,sbin,include} \
     
    356365
    357366  <xsl:template match="sect1" mode="pkgmngt">
    358     <xsl:param name="dirname" select="chapter05"/>
     367    <xsl:param name="dirname" select="'chapter05'"/>
    359368    <!-- The build order -->
    360     <xsl:param name="order" select="062"/>
     369    <xsl:param name="order" select="'062'"/>
    361370<!-- The file names -->
    362371    <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     
    372381set +h
    373382set -e
    374 
    375 cd $PKGDIR
    376 </xsl:text>
     383</xsl:text>
     384        <xsl:call-template name="start-script">
     385          <xsl:with-param name="order" select="concat($order,'-',position())"/>
     386        </xsl:call-template>
    377387        <xsl:apply-templates
    378388           select=".//screen[not(@role) or
     
    395405        <xsl:text>
    396406echo -e "\n\nTotalseconds: $SECONDS\n"
    397 exit
     407</xsl:text>
     408        <xsl:call-template name="end-script"/>
     409        <xsl:text>exit
    398410</xsl:text>
    399411      </exsl:document>
     
    11211133  </xsl:template>
    11221134
     1135  <xsl:template name="basename">
     1136    <xsl:param name="path" select="''"/>
     1137    <xsl:choose>
     1138      <xsl:when test="contains($path,'/') and substring-after($path,'/')!=''">
     1139        <xsl:call-template name="basename">
     1140          <xsl:with-param name="path" select="substring-after($path,'/')"/>
     1141        </xsl:call-template>
     1142      </xsl:when>
     1143      <xsl:when test="contains($path,'/') and substring-after($path,'/')=''">
     1144        <xsl:value-of select="substring-before($path,'/')"/>
     1145      </xsl:when>
     1146      <xsl:otherwise>
     1147        <xsl:value-of select="$path"/>
     1148      </xsl:otherwise>
     1149    </xsl:choose>
     1150  </xsl:template>
     1151
     1152  <xsl:template name="start-script">
     1153    <xsl:param name="order" select="'073'"/>
     1154<!-- get the location of the system root -->
     1155    <xsl:text>
     1156if [ -h /tools ]; then
     1157  ROOT=$(dirname $(readlink /tools))/
     1158else
     1159  ROOT=/
     1160fi
     1161SRC_DIR=${ROOT}sources
     1162<!-- save the timer, so that unpacking, and du is not counted -->
     1163PREV_SEC=${SECONDS}
     1164<!-- Set variables, for use by the Makefile and package manager -->
     1165VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
     1166    <xsl:copy-of select=".//sect1info/productnumber/text()"/>
     1167    <xsl:text>
     1168PKG_DEST=${SRC_DIR}/</xsl:text>
     1169    <xsl:copy-of select="$order"/>
     1170    <xsl:text>-</xsl:text>
     1171    <xsl:copy-of select=".//sect1info/productname/text()"/>
     1172    <xsl:text>
     1173    <!-- Get the tarball name from sect1info -->
     1174PACKAGE=</xsl:text>
     1175    <xsl:call-template name="basename">
     1176      <xsl:with-param name="path" select=".//sect1info/address/text()"/>
     1177    </xsl:call-template>
     1178    <xsl:text>
     1179SCRIPT_ROOT=</xsl:text>
     1180    <xsl:copy-of select="$script-root"/>
     1181    <xsl:text>
     1182</xsl:text>
     1183    <xsl:if test = "( ../@id != 'chapter-temporary-tools' or
     1184                      starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
     1185      <xsl:text>
     1186source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
     1187export -f packInstall</xsl:text>
     1188      <xsl:if test="$wrap-install='y'">
     1189        <xsl:text>
     1190export -f wrapInstall
     1191</xsl:text>
     1192      </xsl:if>
     1193    </xsl:if>
     1194<!-- Get the build directory name and clean remnants of previous attempts -->
     1195    <xsl:text>
     1196cd $SRC_DIR
     1197PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
     1198export PKGDIR VERSION PKG_DEST
     1199
     1200if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
     1201if [ -d "${PKGDIR%-*}-build" ]; then  rm -rf ${PKGDIR%-*}-build; fi
     1202
     1203echo "KB: $(du -skx --exclude=lost+found --exclude=/var/lib --exclude=$SCRIPT_ROOT $ROOT)"
     1204<!-- At last unpack and change directory -->
     1205tar -xf $PACKAGE
     1206cd $PKGDIR
     1207SECONDS=${PREV_SEC}
     1208
     1209# Start of LFS book script
     1210</xsl:text>
     1211  </xsl:template>
     1212
     1213  <xsl:template name="end-script">
     1214    <xsl:text>
     1215# End of LFS book script
     1216
     1217echo "KB: $(du -skx --exclude=lost+found --exclude=/var/lib --exclude=$SCRIPT_ROOT $ROOT)"
     1218cd $SRC_DIR
     1219rm -rf $PKGDIR
     1220if [ -d "${PKGDIR%-*}-build" ]; then  rm -rf ${PKGDIR%-*}-build; fi
     1221</xsl:text>
     1222  </xsl:template>
     1223
    11231224</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.