source: BLFS/libs/func_packages@ f11a672

experimental
Last change on this file since f11a672 was 9c9775f, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated experimental branch to current trunk code.

  • Property mode set to 100644
File size: 7.2 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5set -e
6
7#-----------------------#
8get_pkg_ver() { # Find package version for a given package ID
9#-----------------------#
10 local pkg_id=$1
11
12 case ${pkg_id} in
13 # ALSA packages version
14 alsa* ) pkg_id=alsa ;;
15
16 # KDE packages version
17 kdevelop ) : ;;
18 kde*config ) : ;;
19 kde* ) pkg_id=kde ;;
20
21 # Xorg7 packages version
22 xorg7-server ) pkg_id=xorg-server ;;
23 xterm2 ) pkg_id=xterm ;;
24 xorg7* ) pkg_id=xorg7 ;;
25
26 # Others (ID value don't match entity name)
27 wireless_tools ) pkg_id=wireless-tools ;;
28 bind-utils ) pkg_id=bind ;;
29 html-tidy ) pkg_id=tidy ;;
30 reiserfs ) pkg_id=reiser ;;
31 xfs ) pkg_id=xfsprogs ;;
32 esac
33
34 xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
35 grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g"
36
37}
38
39#-----------------------#
40get_installed_ver() { # Find installed package version for a given package ID
41#-----------------------#
42 local pkg_id=$1
43
44
45 case ${pkg_id} in
46 html-tidy )
47 find $TRACKING_DIR -name "${pkg_id}-cvs_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
48 ;;
49 cdparanoia )
50 find $TRACKING_DIR -name "${pkg_id}-III-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
51 ;;
52 ffmpeg )
53 find $TRACKING_DIR -name "${pkg_id}-svn_[[:digit:]]*" | sed "s/.*${pkg_id}-//"
54 ;;
55 psutils )
56 find $TRACKING_DIR -name "${pkg_id}-p[[:digit:]]*" | sed "s/.*${pkg_id}-//"
57 ;;
58 * )
59 find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" | sed "s/ /_/g"
60 ;;
61 esac
62
63}
64
65#-----------------------#
66generate_packages() { # Master packages file
67#-----------------------#
68 local pkg_id file pkg_ver
69 local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER
70
71 > packages.tmp
72
73 # Extract Id and path for sect1 files
74 for file in `find $BLFS_XML -name "*.xml"` ; do
75 pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
76 case ${pkg_id} in
77 dbus-bindings | \
78 perl-modules | \
79 python-modules ) pkg_ver=0.no_version ;;
80 * ) pkg_ver=$(get_pkg_ver $pkg_id) ;;
81 esac
82 installed_ver=$(get_installed_ver $pkg_id)
83 [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp
84 done
85
86 # IDs clean-up (unuseful pages or commented-out packages, could be more)
87 sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d;/xorg.xml/d' packages.tmp
88 sed -i '/obsolete/d;/ispell\t/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
89 sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d;/^ash\t/d' packages.tmp
90 sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
91 sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d;/arts\t/d' packages.tmp
92 sed -i '/gst-plugins\t/d;/gimp-print\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
93 sed -i '/errata\t/d;/foreword\t/d;/organization\t/d;/whoread\t/d' packages.tmp
94
95 # Meta-packages version
96 ALSA_VER=$(get_pkg_ver alsa)
97 GNOME_VER=$(get_pkg_ver gnome)
98 GNOME_MINOR_VER=$(get_pkg_ver gnome-minor)
99 KDE_VER=$(get_pkg_ver kde)
100 KDE_INST_VER=$(get_installed_ver kde)
101 KDE_KOFFICE_VER=$(get_pkg_ver koffice)
102 XORG7_VER=$(get_pkg_ver xorg7)
103
104 # Meta-packages installed version
105 ALSA_INST_VER=$(get_installed_ver alsa)
106 GNOME_CORE_INST_VER=$(get_installed_ver gnome-core)
107 GNOME_FULL_INST_VER=$(get_installed_ver gnome-full)
108 KDE_CORE_INST_VER=$(get_installed_ver kde-core)
109 KDE_FULL_INST_VER=$(get_installed_ver kde-full)
110 KDE_KOFFICE_INST_VER=$(get_installed_ver kde-koffice)
111 XORG7_INST_VER=$(get_installed_ver xorg7)
112
113 # Add header with meta-packages pseudo Id
114{
115 cat << EOF
116alsa $BLFS_XML $ALSA_VER $ALSA_INST_VER
117gnome-core $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_CORE_INST_VER
118gnome-full $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_FULL_INST_VER
119kde-core $BLFS_XML $KDE_VER $KDE_CORE_INST_VER
120kde-full $BLFS_XML $KDE_VER $KDE_FULL_INST_VER
121kde-koffice $BLFS_XML $KDE_KOFFICE_VER $KDE_KOFFICE_INST_VER
122xorg7 $BLFS_XML $XORG7_VER $XORG7_INST_VER
123EOF
124} >> packages.tmp
125
126 # Dump packages list
127 sort packages.tmp -b --key=2 --field-separator=/ --output=packages
128
129 # Clean up
130 rm packages.tmp
131}
132
133# Pre-made *.dep files for meta-packages
134
135#--------------------------#
136generate_gnome_core() { # GNOME core
137#--------------------------#
138 local line base_xml package
139
140 > gnome-core.dep.tmp
141
142 for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do
143 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
144 package=`grep "gnome/core/$base_xml" packages | cut -f1`
145 [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp
146 done
147
148 # Replace dummy packages with the proper ones
149 sed -i 's/GNOME-//g' gnome-core.dep.tmp
150
151 tac gnome-core.dep.tmp > libs/gnome-core.dep
152 rm gnome-core.dep.tmp
153}
154
155#--------------------------#
156generate_gnome_full() { # GNOME full
157#--------------------------#
158 local line base_xml package
159
160 echo "gnome-core" > gnome-full.dep.tmp
161
162 for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do
163 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
164 package=`grep "gnome/add/$base_xml" packages | cut -f1`
165 [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp
166 done
167
168 tac gnome-full.dep.tmp > libs/gnome-full.dep
169 rm gnome-full.dep.tmp
170}
171
172#--------------------------#
173generate_kde_core() { # KDE core
174#--------------------------#
175 local line base_xml package
176
177 > kde-core.dep.tmp
178
179 for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do
180 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
181 package=`grep "kde/core/$base_xml" packages | cut -f1`
182 [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp
183 done
184
185 tac kde-core.dep.tmp > libs/kde-core.dep
186 rm kde-core.dep.tmp
187}
188
189#--------------------------#
190generate_kde_full() { # KDE full
191#--------------------------#
192 local line base_xml package
193
194 echo "kde-core" > kde-full.dep.tmp
195
196 for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do
197 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
198 package=`grep "kde/add/$base_xml" packages | cut -f1`
199 [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
200 done
201
202 for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do
203 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
204 package=`grep "kde/devel/$base_xml" packages | cut -f1`
205 [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
206 done
207
208 tac kde-full.dep.tmp > libs/kde-full.dep
209 rm kde-full.dep.tmp
210}
211
212#--------------------------#
213generate_kde_koffice() { # KDE full + Koffice
214#--------------------------#
215 echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep
216}
217
218#--------------------------#
219generate_alsa() { # ALSA packages
220#--------------------------#
221 echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\
222alsa-plugins\nalsa-lib" > libs/alsa.dep
223}
224
225#--------------------------#
226generate_xorg7() { # Xorg7 packages
227#--------------------------#
228 echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
229xkeyboard-config\nxorg7-font\nxorg7-data\nxorg7-app\nmesalib\nlibdrm\nxbitmaps\n\
230xorg7-lib\nlibxcb\nxcb-proto\nlibXdmcp\nlibXau\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
231}
Note: See TracBrowser for help on using the repository browser.