source: BLFS/gen-special.sh@ 970f2dc

ablfs
Last change on this file since 970f2dc was 96a30c7, checked in by Pierre Labastie <pierre@…>, 13 years ago

Adds -j1 to "make install", impose a dependency on preceding package in X*
chapter

  • Property mode set to 100755
File size: 5.2 KB
Line 
1#!/bin/bash
2
3# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $
4
5BLFS_XML=$1
6if ! test -f ${BLFS_XML}; then
7 echo ${BLFS_XML} does not exist
8 exit 1
9fi
10SPECIAL_FILE=$2
11if test -z "${SPECIAL_FILE}"; then SPECIAL_FILE=specialCases.xsl;fi
12# Packages whose version does not begin with a number
13EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' $BLFS_XML |
14 sed 's@^[^"]*"\([^"]*\)".*@\1@')
15# Version for X Window packages without a version in the book
16XVERSION=$(grep 'ENTITY xorg7-release' $BLFS_XML |
17 sed 's@^[^"]*"\([^"]*\)".*@\1@')
18# The case of udev
19# Set PATH to be sure to find udevadm
20SAVPATH=$PATH
21PATH=/bin:/sbin:/usr/bin:/usr/sbin
22UDEVVERSION=$(udevadm --version)
23
24cat >$SPECIAL_FILE << EOF
25<?xml version="1.0" encoding="ISO-8859-1"?>
26
27<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 version="1.0">
29
30<xsl:template match='*' mode="special">
31 <xsl:choose>
32 <xsl:when test="@id='udev'">
33 <xsl:text> </xsl:text>
34 <package><xsl:text>&#xA; </xsl:text>
35 <xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
36 <xsl:text>&#xA; </xsl:text>
37 <xsl:element name="version">$UDEVVERSION</xsl:element>
38 <xsl:if
39 test="document(\$installed-packages)//package[name=current()/@id]">
40 <xsl:text>&#xA; </xsl:text>
41 <xsl:element name="inst-version">
42 <xsl:value-of
43 select="document(\$installed-packages
44 )//package[name=current()/@id]/version"/>
45 </xsl:element>
46 </xsl:if>
47<!-- Dependencies -->
48 <xsl:apply-templates select=".//para[@role='required' or
49 @role='recommended' or
50 @role='optional']"
51 mode="dependency"/>
52<!-- End dependencies -->
53 <xsl:text>&#xA; </xsl:text>
54 </package><xsl:text>&#xA;</xsl:text>
55 </xsl:when>
56 <xsl:when test="@id='xorg7'"/>
57 <xsl:when test="../@id='x-window-system' and
58 not(contains(translate(@xreflabel,
59 '123456789',
60 '000000000'),
61 '-0'))">
62 <xsl:text> </xsl:text>
63 <package><xsl:text>&#xA; </xsl:text>
64 <xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
65 <xsl:text>&#xA; </xsl:text>
66 <xsl:element name="version">$XVERSION</xsl:element>
67 <xsl:if
68 test="document(\$installed-packages)//package[name=current()/@id]">
69 <xsl:text>&#xA; </xsl:text>
70 <xsl:element name="inst-version">
71 <xsl:value-of
72 select="document(\$installed-packages
73 )//package[name=current()/@id]/version"/>
74 </xsl:element>
75 </xsl:if>
76<!-- Dependencies -->
77 <xsl:text>
78 </xsl:text>
79 <xsl:element name="dependency">
80 <xsl:attribute name="status">required</xsl:attribute>
81 <xsl:attribute name="name">
82 <xsl:value-of
83 select="preceding-sibling::sect1[1]/@id"/>
84 </xsl:attribute>
85 <xsl:attribute name="type">ref</xsl:attribute>
86 </xsl:element>
87 <xsl:apply-templates select=".//para[@role='required' or
88 @role='recommended' or
89 @role='optional']"
90 mode="dependency"/>
91<!-- End dependencies -->
92 <xsl:text>&#xA; </xsl:text>
93 </package><xsl:text>&#xA;</xsl:text>
94 </xsl:when>
95EOF
96
97for ver_ent in $EXCEPTIONS; do
98 id=$(grep 'xreflabel=".*'$ver_ent $BLFS_XML | sed 's@.*id="\([^"]*\)".*@\1@')
99 [[ -z $id ]] && continue
100 cat >>$SPECIAL_FILE << EOF
101 <xsl:when test="@id='$id'">
102 <xsl:text> </xsl:text>
103 <package><xsl:text>&#xA; </xsl:text>
104 <xsl:element name="name">$id</xsl:element>
105 <xsl:text>&#xA; </xsl:text>
106 <xsl:element name="version">$ver_ent</xsl:element>
107 <xsl:if
108 test="document(\$installed-packages)//package[name=current()/@id]">
109 <xsl:text>&#xA; </xsl:text>
110 <xsl:element name="inst-version">
111 <xsl:value-of
112 select="document(\$installed-packages
113 )//package[name=current()/@id]/version"/>
114 </xsl:element>
115 </xsl:if>
116<!-- Dependencies -->
117 <xsl:apply-templates select=".//para[@role='required' or
118 @role='recommended' or
119 @role='optional']"
120 mode="dependency"/>
121<!-- End dependencies -->
122 <xsl:text>&#xA; </xsl:text>
123 </package><xsl:text>&#xA;</xsl:text>
124 </xsl:when>
125EOF
126done
127
128cat >>$SPECIAL_FILE << EOF
129 <xsl:otherwise>
130 <xsl:apply-templates
131 select="self::node()[contains(translate(@xreflabel,
132 '123456789',
133 '000000000'),
134 '-0')
135 ]"
136 mode="normal"/>
137 </xsl:otherwise>
138 </xsl:choose>
139</xsl:template>
140
141</xsl:stylesheet>
142EOF
Note: See TracBrowser for help on using the repository browser.