[0170229] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
[3a5c9cc] | 3 | <!-- $Id$ -->
|
---|
| 4 |
|
---|
[0170229] | 5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 6 | xmlns:exsl="http://exslt.org/common"
|
---|
| 7 | extension-element-prefixes="exsl"
|
---|
| 8 | version="1.0">
|
---|
| 9 |
|
---|
| 10 | <!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
---|
| 11 |
|
---|
[1f10495] | 12 | <!-- Including common extensions templates -->
|
---|
| 13 | <xsl:include href="../XSL/user.xsl"/>
|
---|
[bfcaaa0] | 14 | <xsl:include href="../XSL/custom-tools.xsl"/>
|
---|
| 15 | <xsl:include href="../XSL/blfs-tool.xsl"/>
|
---|
[1f10495] | 16 |
|
---|
[3778352] | 17 | <!-- ####################### PARAMETERS ################################### -->
|
---|
| 18 |
|
---|
[6db1464] | 19 | <!-- Run test suites?
|
---|
| 20 | 0 = none
|
---|
| 21 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 22 | 2 = all chapter06 testsuites
|
---|
[056486c] | 23 | 3 = all chapter05 and chapter06 testsuites
|
---|
| 24 | -->
|
---|
[c0f8256] | 25 | <xsl:param name="testsuite">1</xsl:param>
|
---|
[0170229] | 26 |
|
---|
[056486c] | 27 | <!-- Bomb on test suites failures?
|
---|
[47fddc8] | 28 | n = no, I want to build the full system and review the logs
|
---|
| 29 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[056486c] | 30 | -->
|
---|
[c0f8256] | 31 | <xsl:param name="bomb-testsuite">n</xsl:param>
|
---|
[056486c] | 32 |
|
---|
[0170229] | 33 | <!-- Install vim-lang package? -->
|
---|
[c0f8256] | 34 | <xsl:param name="vim-lang">y</xsl:param>
|
---|
[0170229] | 35 |
|
---|
[ad71d98] | 36 | <!-- Time zone -->
|
---|
[c0f8256] | 37 | <xsl:param name="timezone">GMT</xsl:param>
|
---|
[ad71d98] | 38 |
|
---|
| 39 | <!-- Page size -->
|
---|
[c0f8256] | 40 | <xsl:param name="page">letter</xsl:param>
|
---|
[ad71d98] | 41 |
|
---|
[3778352] | 42 | <!-- Locale setting -->
|
---|
[c0f8256] | 43 | <xsl:param name="lang">C</xsl:param>
|
---|
| 44 |
|
---|
| 45 | <!-- Custom tools support -->
|
---|
| 46 | <xsl:param name="custom-tools">n</xsl:param>
|
---|
| 47 |
|
---|
| 48 | <!-- blfs-tool support -->
|
---|
| 49 | <xsl:param name="blfs-tool">n</xsl:param>
|
---|
[d87b293] | 50 |
|
---|
[13b4ab5] | 51 |
|
---|
| 52 | <!-- ####################################################################### -->
|
---|
| 53 |
|
---|
[3778352] | 54 | <!-- ############################# MATCH TEMPLATES ########################## -->
|
---|
| 55 |
|
---|
| 56 | <!-- Root element -->
|
---|
[0170229] | 57 | <xsl:template match="/">
|
---|
[13b4ab5] | 58 | <!-- Start processing at chapter level -->
|
---|
[3778352] | 59 | <xsl:apply-templates select="//chapter"/>
|
---|
[c0f8256] | 60 | <!-- Process custom tools scripts -->
|
---|
| 61 | <xsl:if test="$custom-tools = 'y'">
|
---|
| 62 | <xsl:call-template name="custom-tools"/>
|
---|
| 63 | </xsl:if>
|
---|
| 64 | <!-- Process blfs-tool scripts -->
|
---|
| 65 | <xsl:if test="$blfs-tool = 'y'">
|
---|
| 66 | <xsl:call-template name="blfs-tool"/>
|
---|
| 67 | </xsl:if>
|
---|
[0170229] | 68 | </xsl:template>
|
---|
| 69 |
|
---|
[3778352] | 70 |
|
---|
| 71 | <!-- chapter -->
|
---|
| 72 | <xsl:template match="chapter">
|
---|
| 73 | <xsl:if test="@id='chapter-temporary-tools' or @id='chapter-building-system'
|
---|
| 74 | or @id='chapter-bootscripts' or @id='chapter-bootable'">
|
---|
| 75 | <!-- The dir name -->
|
---|
| 76 | <xsl:variable name="dirname">
|
---|
| 77 | <xsl:call-template name="dirname"/>
|
---|
| 78 | </xsl:variable>
|
---|
| 79 | <!-- The chapter order position -->
|
---|
| 80 | <xsl:variable name="ch_position" select="position()"/>
|
---|
| 81 | <xsl:variable name="ch_order">
|
---|
[0170229] | 82 | <xsl:choose>
|
---|
[3778352] | 83 | <xsl:when test="string-length($ch_position) = 1">
|
---|
[0170229] | 84 | <xsl:text>0</xsl:text>
|
---|
[3778352] | 85 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 86 | </xsl:when>
|
---|
| 87 | <xsl:otherwise>
|
---|
[3778352] | 88 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 89 | </xsl:otherwise>
|
---|
| 90 | </xsl:choose>
|
---|
| 91 | </xsl:variable>
|
---|
[13b4ab5] | 92 | <!-- Process the childrens -->
|
---|
[3778352] | 93 | <xsl:apply-templates select="sect1">
|
---|
| 94 | <xsl:with-param name="ch_order" select="$ch_order"/>
|
---|
| 95 | <xsl:with-param name="dirname" select="$dirname"/>
|
---|
| 96 | </xsl:apply-templates>
|
---|
| 97 | </xsl:if>
|
---|
| 98 | </xsl:template>
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | <!-- sect1 -->
|
---|
| 102 | <xsl:template match="sect1">
|
---|
| 103 | <!-- Inherited chapter order -->
|
---|
| 104 | <xsl:param name="ch_order" select="foo"/>
|
---|
| 105 | <!-- Inherited dir name -->
|
---|
| 106 | <xsl:param name="dirname" select="foo"/>
|
---|
[e213e4c] | 107 | <!-- Process only files with actual build commands -->
|
---|
[3778352] | 108 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
| 109 | count(descendant::screen/userinput) >
|
---|
| 110 | count(descendant::screen[@role='nodump'])">
|
---|
| 111 | <!-- Base file name -->
|
---|
| 112 | <xsl:variable name="filename">
|
---|
| 113 | <xsl:call-template name="filename"/>
|
---|
| 114 | </xsl:variable>
|
---|
| 115 | <!-- Sect1 order position -->
|
---|
| 116 | <xsl:variable name="sect1_position" select="position()"/>
|
---|
| 117 | <xsl:variable name="sect1_order">
|
---|
[0170229] | 118 | <xsl:choose>
|
---|
[3778352] | 119 | <xsl:when test="string-length($sect1_position) = 1">
|
---|
| 120 | <xsl:text>0</xsl:text>
|
---|
| 121 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 122 | </xsl:when>
|
---|
| 123 | <xsl:otherwise>
|
---|
[3778352] | 124 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 125 | </xsl:otherwise>
|
---|
| 126 | </xsl:choose>
|
---|
[3778352] | 127 | </xsl:variable>
|
---|
| 128 | <!-- Script build order -->
|
---|
[097df00] | 129 | <xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
|
---|
[f5f857d] | 130 | <!-- Must the package test suite, if any, be run? -->
|
---|
| 131 | <xsl:variable name="run_this_test">
|
---|
| 132 | <xsl:call-template name="run_this_test"/>
|
---|
| 133 | </xsl:variable>
|
---|
[097df00] | 134 | <!-- Hock to insert scripts before the current one -->
|
---|
| 135 | <xsl:call-template name="insert_script_before">
|
---|
| 136 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 137 | <xsl:with-param name="order" select="$order"/>
|
---|
| 138 | </xsl:call-template>
|
---|
[3778352] | 139 | <!-- Creating dirs and files -->
|
---|
[097df00] | 140 | <exsl:document href="{$order}-{$filename}" method="text">
|
---|
[3778352] | 141 | <xsl:call-template name="header"/>
|
---|
[13b4ab5] | 142 | <xsl:call-template name="user_header"/>
|
---|
| 143 | <xsl:apply-templates select="sect1info[@condition='script']">
|
---|
| 144 | <xsl:with-param name="phase" select="$filename"/>
|
---|
[f5f857d] | 145 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 146 | <xsl:with-param name="testlogfile" select="concat($ch_order,'_',$sect1_order,'-',$filename)"/>
|
---|
[13b4ab5] | 147 | </xsl:apply-templates>
|
---|
[51e3d23] | 148 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 149 | <xsl:if test="sect2[@role='installation']">
|
---|
| 150 | <xsl:call-template name="unpack"/>
|
---|
| 151 | </xsl:if>
|
---|
[13b4ab5] | 152 | <xsl:call-template name="user_pre_commands"/>
|
---|
[3778352] | 153 | <xsl:call-template name="pre_commands"/>
|
---|
[f5f857d] | 154 | <xsl:apply-templates select=".//screen">
|
---|
| 155 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 156 | </xsl:apply-templates>
|
---|
[3778352] | 157 | <xsl:call-template name="post_commands"/>
|
---|
[13b4ab5] | 158 | <xsl:call-template name="user_footer"/>
|
---|
[51e3d23] | 159 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 160 | <xsl:if test="sect2[@role='installation']">
|
---|
| 161 | <xsl:call-template name="clean_sources"/>
|
---|
| 162 | </xsl:if>
|
---|
[3778352] | 163 | <xsl:call-template name="footer"/>
|
---|
[0170229] | 164 | </exsl:document>
|
---|
[097df00] | 165 | <!-- Hock to insert scripts after the current one -->
|
---|
| 166 | <xsl:call-template name="insert_script_after">
|
---|
| 167 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 168 | <xsl:with-param name="order" select="$order"/>
|
---|
| 169 | </xsl:call-template>
|
---|
[0170229] | 170 | </xsl:if>
|
---|
| 171 | </xsl:template>
|
---|
| 172 |
|
---|
[3778352] | 173 |
|
---|
[13b4ab5] | 174 | <!-- sect1info -->
|
---|
| 175 | <xsl:template match="sect1info">
|
---|
[f5f857d] | 176 | <!-- Used to set and initialize the testuite log file -->
|
---|
| 177 | <xsl:param name="testlogfile" select="foo"/>
|
---|
| 178 | <xsl:param name="run_this_test" select="foo"/>
|
---|
[13b4ab5] | 179 | <!-- Build phase (base file name) to be used for PM -->
|
---|
| 180 | <xsl:param name="phase" select="foo"/>
|
---|
| 181 | <xsl:text>
PKG_PHASE=</xsl:text>
|
---|
| 182 | <xsl:value-of select="$phase"/>
|
---|
| 183 | <!-- Package name -->
|
---|
| 184 | <xsl:apply-templates select="productname"/>
|
---|
| 185 | <!-- Package version -->
|
---|
| 186 | <xsl:apply-templates select="productnumber"/>
|
---|
| 187 | <!-- Tarball name -->
|
---|
| 188 | <xsl:apply-templates select="address"/>
|
---|
[f5f857d] | 189 | <xsl:if test="$run_this_test = '1'">
|
---|
| 190 | <xsl:text>
TEST_LOG=</xsl:text>
|
---|
| 191 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 192 | <xsl:text>$LFS</xsl:text>
|
---|
| 193 | </xsl:if>
|
---|
| 194 | <xsl:text>/jhalfs/test-logs/</xsl:text>
|
---|
| 195 | <xsl:value-of select="$testlogfile"/>
|
---|
[bfcaaa0] | 196 | <xsl:text>
echo -e "\n`date`\n" > $TEST_LOG</xsl:text>
|
---|
[f5f857d] | 197 | </xsl:if>
|
---|
[13b4ab5] | 198 | <xsl:text>

</xsl:text>
|
---|
| 199 | </xsl:template>
|
---|
| 200 |
|
---|
| 201 |
|
---|
| 202 | <!-- productname -->
|
---|
| 203 | <xsl:template match="productname">
|
---|
| 204 | <xsl:text>
PACKAGE=</xsl:text>
|
---|
| 205 | <xsl:apply-templates/>
|
---|
| 206 | </xsl:template>
|
---|
| 207 |
|
---|
| 208 |
|
---|
| 209 | <!-- productnumber -->
|
---|
| 210 | <xsl:template match="productnumber">
|
---|
| 211 | <xsl:text>
VERSION=</xsl:text>
|
---|
| 212 | <xsl:apply-templates/>
|
---|
| 213 | </xsl:template>
|
---|
| 214 |
|
---|
| 215 |
|
---|
| 216 | <!-- address -->
|
---|
| 217 | <xsl:template match="address">
|
---|
| 218 | <xsl:text>
TARBALL=</xsl:text>
|
---|
| 219 | <xsl:call-template name="package_name">
|
---|
| 220 | <xsl:with-param name="url">
|
---|
| 221 | <xsl:apply-templates/>
|
---|
| 222 | </xsl:with-param>
|
---|
| 223 | </xsl:call-template>
|
---|
| 224 | <xsl:apply-templates select="otheraddr" mode="tarball"/>
|
---|
| 225 | </xsl:template>
|
---|
[3778352] | 226 |
|
---|
| 227 |
|
---|
[13b4ab5] | 228 | <!-- otheraddr -->
|
---|
| 229 | <xsl:template match="otheraddr"/>
|
---|
| 230 | <xsl:template match="otheraddr" mode="tarball">
|
---|
| 231 | <xsl:text>
TARBALL_</xsl:text>
|
---|
| 232 | <xsl:value-of select="position()"/>
|
---|
| 233 | <xsl:text>=</xsl:text>
|
---|
| 234 | <xsl:call-template name="package_name">
|
---|
| 235 | <xsl:with-param name="url" select="."/>
|
---|
| 236 | </xsl:call-template>
|
---|
| 237 | </xsl:template>
|
---|
[3778352] | 238 |
|
---|
| 239 |
|
---|
[13b4ab5] | 240 | <!-- screen -->
|
---|
[0170229] | 241 | <xsl:template match="screen">
|
---|
[f5f857d] | 242 | <xsl:param name="run_this_test" select="foo"/>
|
---|
[6db1464] | 243 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
[fa1b640] | 244 | <xsl:call-template name="top_screen_build_fixes"/>
|
---|
[f5f857d] | 245 | <xsl:apply-templates>
|
---|
| 246 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 247 | </xsl:apply-templates>
|
---|
[fa1b640] | 248 | <xsl:call-template name="bottom_screen_build_fixes"/>
|
---|
| 249 | <xsl:text>
</xsl:text>
|
---|
[0170229] | 250 | </xsl:if>
|
---|
| 251 | </xsl:template>
|
---|
| 252 |
|
---|
[13b4ab5] | 253 |
|
---|
[f5f857d] | 254 | <!-- userinput @remap='test' -->
|
---|
| 255 | <xsl:template match="userinput[@remap='test']">
|
---|
| 256 | <xsl:param name="run_this_test" select="foo"/>
|
---|
| 257 | <xsl:apply-templates select="." mode="test">
|
---|
| 258 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 259 | </xsl:apply-templates>
|
---|
| 260 | </xsl:template>
|
---|
| 261 |
|
---|
| 262 |
|
---|
[e213e4c] | 263 | <!-- replaceable -->
|
---|
| 264 | <xsl:template match="replaceable">
|
---|
| 265 | <xsl:choose>
|
---|
| 266 | <!-- Configuring the Time Zone -->
|
---|
| 267 | <xsl:when test="ancestor::sect2[@id='conf-glibc'] and string()='<xxx>'">
|
---|
| 268 | <xsl:value-of select="$timezone"/>
|
---|
| 269 | </xsl:when>
|
---|
| 270 | <!-- Set paper size for Groff build -->
|
---|
| 271 | <xsl:when test="string()='<paper_size>'">
|
---|
| 272 | <xsl:value-of select="$page"/>
|
---|
| 273 | </xsl:when>
|
---|
| 274 | <!-- LANG setting in /etc/profile -->
|
---|
| 275 | <xsl:when test="contains(string(),'<ll>_<CC>')">
|
---|
| 276 | <xsl:value-of select="$lang"/>
|
---|
| 277 | </xsl:when>
|
---|
| 278 | <xsl:otherwise>
|
---|
| 279 | <xsl:text>**EDITME</xsl:text>
|
---|
| 280 | <xsl:apply-templates/>
|
---|
| 281 | <xsl:text>EDITME**</xsl:text>
|
---|
| 282 | </xsl:otherwise>
|
---|
| 283 | </xsl:choose>
|
---|
| 284 | </xsl:template>
|
---|
| 285 |
|
---|
| 286 |
|
---|
| 287 | <!-- ######################################################################## -->
|
---|
| 288 |
|
---|
| 289 | <!-- ############################# MODE TEMPLATES ########################### -->
|
---|
| 290 |
|
---|
| 291 |
|
---|
| 292 | <!-- mode test -->
|
---|
| 293 | <xsl:template match="userinput" mode="test">
|
---|
[f5f857d] | 294 | <xsl:param name="run_this_test" select="foo"/>
|
---|
| 295 | <xsl:if test="$run_this_test = '1'">
|
---|
| 296 | <xsl:choose>
|
---|
| 297 | <!-- Final system Glibc -->
|
---|
| 298 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 299 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 300 | <xsl:text>>> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 301 | </xsl:when>
|
---|
| 302 | <!-- Module-Init-Tools -->
|
---|
| 303 | <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
|
---|
| 304 | and contains(string(),'make check')">
|
---|
| 305 | <xsl:value-of select="substring-before(string(),' check')"/>
|
---|
| 306 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 307 | <xsl:text> -k</xsl:text>
|
---|
| 308 | </xsl:if>
|
---|
| 309 | <xsl:text> check >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 310 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 311 | <xsl:text> || true</xsl:text>
|
---|
| 312 | </xsl:if>
|
---|
| 313 | <xsl:value-of select="substring-after(string(),' check')"/>
|
---|
| 314 | </xsl:when>
|
---|
| 315 | <!-- If the book uses -k, the testsuite should never bomb -->
|
---|
| 316 | <xsl:when test="contains(string(),'make -k ')">
|
---|
| 317 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 318 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 319 | </xsl:when>
|
---|
| 320 | <!-- Extra commands in Binutils and GCC -->
|
---|
| 321 | <xsl:when test="contains(string(),'test_summary') or
|
---|
| 322 | contains(string(),'expect -c')">
|
---|
| 323 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 324 | <xsl:text> >> $TEST_LOG</xsl:text>
|
---|
| 325 | </xsl:when>
|
---|
| 326 | <!-- Remaining extra testsuite commads that don't need be hacked -->
|
---|
| 327 | <xsl:when test="not(contains(string(),'make '))">
|
---|
| 328 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 329 | </xsl:when>
|
---|
| 330 | <!-- Normal testsites run -->
|
---|
| 331 | <xsl:otherwise>
|
---|
| 332 | <xsl:choose>
|
---|
| 333 | <!-- No bomb on failures -->
|
---|
| 334 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
| 335 | <xsl:value-of select="substring-before(string(),'make ')"/>
|
---|
| 336 | <xsl:text>make -k </xsl:text>
|
---|
| 337 | <xsl:value-of select="substring-after(string(),'make ')"/>
|
---|
| 338 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 339 | </xsl:when>
|
---|
| 340 | <!-- Bomb at the first failure -->
|
---|
| 341 | <xsl:otherwise>
|
---|
| 342 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 343 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 344 | </xsl:otherwise>
|
---|
| 345 | </xsl:choose>
|
---|
| 346 | </xsl:otherwise>
|
---|
| 347 | </xsl:choose>
|
---|
| 348 | </xsl:if>
|
---|
[0170229] | 349 | </xsl:template>
|
---|
| 350 |
|
---|
[bfcaaa0] | 351 |
|
---|
| 352 | <!-- ######################################################################## -->
|
---|
| 353 |
|
---|
| 354 | <!-- ########################### NAMED TEMPLATES ########################### -->
|
---|
| 355 |
|
---|
| 356 | <!-- Chapter directory name (the same used for HTML output) -->
|
---|
| 357 | <xsl:template name="dirname">
|
---|
| 358 | <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/>
|
---|
| 359 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 360 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 361 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 362 | <xsl:value-of select="$dirname"/>
|
---|
| 363 | </xsl:template>
|
---|
| 364 |
|
---|
| 365 |
|
---|
| 366 | <!-- Base file name (the same used for HTML output) -->
|
---|
| 367 | <xsl:template name="filename">
|
---|
| 368 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 369 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 370 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 371 | <xsl:value-of select="$filename"/>
|
---|
| 372 | </xsl:template>
|
---|
| 373 |
|
---|
| 374 |
|
---|
| 375 | <!-- Script header -->
|
---|
| 376 | <xsl:template name="header">
|
---|
| 377 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 378 | not(@id='ch-system-revisedchroot')">
|
---|
| 379 | <!-- Set the shabang -->
|
---|
| 380 | <xsl:choose>
|
---|
| 381 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
| 382 | @id='ch-system-createfiles' or
|
---|
| 383 | @id='ch-system-strippingagain'">
|
---|
| 384 | <xsl:text>#!/tools/bin/bash
</xsl:text>
|
---|
| 385 | </xsl:when>
|
---|
| 386 | <xsl:otherwise>
|
---|
| 387 | <xsl:text>#!/bin/bash
</xsl:text>
|
---|
| 388 | </xsl:otherwise>
|
---|
| 389 | </xsl:choose>
|
---|
| 390 | <!-- Set +h -->
|
---|
| 391 | <xsl:text>set +h
</xsl:text>
|
---|
| 392 | <!-- Set -e -->
|
---|
| 393 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 394 | not(@id='ch-system-strippingagain')">
|
---|
| 395 | <xsl:text>set -e
</xsl:text>
|
---|
| 396 | </xsl:if>
|
---|
| 397 | <!-- Dump a time stamp -->
|
---|
| 398 | <xsl:text>
echo -e "\n`date`\n"
</xsl:text>
|
---|
| 399 | </xsl:if>
|
---|
| 400 | </xsl:template>
|
---|
| 401 |
|
---|
| 402 |
|
---|
| 403 | <!-- Dump current disk usage -->
|
---|
| 404 | <xsl:template name="disk_usage">
|
---|
| 405 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 406 | not(@id='ch-system-revisedchroot')">
|
---|
| 407 | <xsl:choose>
|
---|
| 408 | <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 409 | <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"
</xsl:text>
|
---|
| 410 | </xsl:when>
|
---|
| 411 | <xsl:otherwise>
|
---|
| 412 | <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"
</xsl:text>
|
---|
| 413 | </xsl:otherwise>
|
---|
| 414 | </xsl:choose>
|
---|
| 415 | </xsl:if>
|
---|
| 416 | </xsl:template>
|
---|
| 417 |
|
---|
| 418 |
|
---|
| 419 | <!-- Enter to the sources dir, clean it, unpack the tarball,
|
---|
| 420 | and reset the seconds counter -->
|
---|
| 421 | <xsl:template name="unpack">
|
---|
| 422 | <xsl:text>cd </xsl:text>
|
---|
| 423 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 424 | <xsl:text>$LFS</xsl:text>
|
---|
| 425 | </xsl:if>
|
---|
| 426 | <xsl:text>/sources
|
---|
| 427 | PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
|
---|
| 428 | if [ -d $PKGDIR ]; then
|
---|
| 429 | rm -rf $PKGDIR
|
---|
| 430 | fi
|
---|
| 431 | if [ -d ${PKGDIR%-*}-build ]; then
|
---|
| 432 | rm -rf ${PKGDIR%-*}-build
|
---|
| 433 | fi
|
---|
| 434 | tar -xf $TARBALL
|
---|
| 435 | SECONDS=0
|
---|
| 436 | </xsl:text>
|
---|
| 437 | </xsl:template>
|
---|
| 438 |
|
---|
| 439 |
|
---|
| 440 | <!-- Extra previous commands needed by the book but not inside screen tags -->
|
---|
| 441 | <xsl:template name="pre_commands">
|
---|
| 442 | <xsl:if test="sect2[@role='installation']">
|
---|
| 443 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
| 444 | </xsl:if>
|
---|
| 445 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
| 446 | <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text>
|
---|
| 447 | </xsl:if>
|
---|
| 448 | </xsl:template>
|
---|
| 449 |
|
---|
| 450 |
|
---|
| 451 | <!-- Extra post commands needed by the book but not inside screen tags -->
|
---|
| 452 | <xsl:template name="post_commands">
|
---|
| 453 | <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
|
---|
| 454 | <xsl:variable name="content" select="//userinput[@remap='locale-test']"/>
|
---|
| 455 | <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/>
|
---|
| 456 | <xsl:text>/tools/lib/locale</xsl:text>
|
---|
| 457 | <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>
|
---|
| 458 | </xsl:if>
|
---|
| 459 | </xsl:template>
|
---|
| 460 |
|
---|
| 461 |
|
---|
| 462 | <!-- Remove sources and build dirs, skipping it from seconds meassurament -->
|
---|
| 463 | <xsl:template name="clean_sources">
|
---|
| 464 | <xsl:text>cd </xsl:text>
|
---|
| 465 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 466 | <xsl:text>$LFS</xsl:text>
|
---|
| 467 | </xsl:if>
|
---|
| 468 | <xsl:text>/sources
|
---|
| 469 | SECS=$SECONDS
|
---|
| 470 | rm -rf $PKGDIR
|
---|
| 471 | rm -rf ${PKGDIR%-*}-build
|
---|
| 472 | SECONDS=$SECS
|
---|
| 473 | </xsl:text>
|
---|
| 474 | </xsl:template>
|
---|
| 475 |
|
---|
| 476 |
|
---|
| 477 | <!-- Script footer -->
|
---|
| 478 | <xsl:template name="footer">
|
---|
| 479 | <!-- Dump the build time and exit -->
|
---|
| 480 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 481 | not(@id='ch-system-revisedchroot')">
|
---|
| 482 | <xsl:text>
|
---|
| 483 | echo -e "\n\nTotalseconds: $SECONDS\n"
|
---|
| 484 |
|
---|
| 485 | exit
|
---|
| 486 | </xsl:text>
|
---|
| 487 | </xsl:if>
|
---|
| 488 | </xsl:template>
|
---|
| 489 |
|
---|
| 490 |
|
---|
| 491 | <!-- Extra commads needed at the start of some screen block
|
---|
| 492 | to allow automatization -->
|
---|
| 493 | <xsl:template name="top_screen_build_fixes">
|
---|
| 494 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 495 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 496 | <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>
|
---|
| 497 | </xsl:if>
|
---|
| 498 | </xsl:template>
|
---|
| 499 |
|
---|
| 500 |
|
---|
| 501 | <!-- Extra commads needed at the end of some screen block
|
---|
| 502 | to allow automatization -->
|
---|
| 503 | <xsl:template name="bottom_screen_build_fixes">
|
---|
| 504 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 505 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 506 | <xsl:text>
fi</xsl:text>
|
---|
| 507 | </xsl:if>
|
---|
| 508 | <!-- Copying the kernel config file -->
|
---|
| 509 | <xsl:if test="string() = 'make mrproper'">
|
---|
| 510 | <xsl:text>
cp -v ../kernel-config .config</xsl:text>
|
---|
| 511 | </xsl:if>
|
---|
| 512 | <!-- Don't stop on strip run -->
|
---|
| 513 | <xsl:if test="contains(string(),'strip --strip')">
|
---|
| 514 | <xsl:text> || true</xsl:text>
|
---|
| 515 | </xsl:if>
|
---|
| 516 | </xsl:template>
|
---|
| 517 |
|
---|
| 518 |
|
---|
| 519 | <!-- Extract a package name from a package URL -->
|
---|
| 520 | <xsl:template name="package_name">
|
---|
| 521 | <xsl:param name="url" select="foo"/>
|
---|
| 522 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 523 | <xsl:choose>
|
---|
| 524 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 525 | <xsl:call-template name="package_name">
|
---|
| 526 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 527 | </xsl:call-template>
|
---|
| 528 | </xsl:when>
|
---|
| 529 | <xsl:otherwise>
|
---|
| 530 | <xsl:value-of select="$sub-url"/>
|
---|
| 531 | </xsl:otherwise>
|
---|
| 532 | </xsl:choose>
|
---|
| 533 | </xsl:template>
|
---|
| 534 |
|
---|
| 535 |
|
---|
| 536 | <!-- Check if a package testsuite must be run -->
|
---|
| 537 | <xsl:template name="run_this_test">
|
---|
| 538 | <xsl:choose>
|
---|
| 539 | <xsl:when test=".//userinput[@remap='test']">
|
---|
| 540 | <xsl:choose>
|
---|
| 541 | <!-- No testsuites run on level 0 -->
|
---|
| 542 | <xsl:when test="$testsuite = '0'">0</xsl:when>
|
---|
| 543 | <!-- On level 1, only final system toolchain testsuites are run -->
|
---|
| 544 | <xsl:when test="$testsuite = '1' and
|
---|
| 545 | not(@id='ch-system-gcc') and
|
---|
| 546 | not(@id='ch-system-glibc') and
|
---|
| 547 | not(@id='ch-system-binutils')">0</xsl:when>
|
---|
| 548 | <!-- On level 2, temp tools testsuites are not run -->
|
---|
| 549 | <xsl:when test="$testsuite = '2' and
|
---|
| 550 | ../@id='chapter-temporary-tools'">0</xsl:when>
|
---|
| 551 | <xsl:otherwise>1</xsl:otherwise>
|
---|
| 552 | </xsl:choose>
|
---|
| 553 | </xsl:when>
|
---|
| 554 | <xsl:otherwise>0</xsl:otherwise>
|
---|
| 555 | </xsl:choose>
|
---|
| 556 | </xsl:template>
|
---|
| 557 |
|
---|
[0170229] | 558 | </xsl:stylesheet>
|
---|