source: BLFS/libs/func_packages@ bc40917

experimental
Last change on this file since bc40917 was cac94f6, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Added installed version to packages database

  • Property mode set to 100644
File size: 6.3 KB
RevLine 
[5769ccd]1#!/bin/bash
2#
3# $Id$
4#
5set -e
6
[8b0d3b3]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 jdk ) pkg_id=jdk-src ;;
31 reiserfs ) pkg_id=reiser ;;
32 xfs ) pkg_id=xfsprogs ;;
33 esac
34
[c0077b1]35 xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
[8b0d3b3]36 grep -i " ${pkg_id}-version " | cut -d "\"" -f2
37
38}
39
[cac94f6]40#-----------------------#
41get_installed_ver() { # Find installed package version for a given package ID
42#-----------------------#
43 local pkg_id=$1
44
45 find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
46
47}
48
[5769ccd]49#-----------------------#
50generate_packages() { # Master packages file
51#-----------------------#
[8b0d3b3]52 local pkg_id file pkg_ver
53 local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER
[5769ccd]54
55 > packages.tmp
56
57 # Extract Id and path for sect1 files
58 for file in `find $BLFS_XML -name "*.xml"` ; do
[8b0d3b3]59 pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
60 pkg_ver=$(get_pkg_ver $pkg_id)
[cac94f6]61 installed_ver=$(get_installed_ver $pkg_id)
62 [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp
[5769ccd]63 done
64
65 # IDs clean-up (unuseful pages or commented-out packages, could be more)
[323f805]66 sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp
67 sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
[de14f6a]68 sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp
[8b0d3b3]69 sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
[ec12033]70 sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp
71 sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
[5769ccd]72
[8b0d3b3]73 # Meta-packages version
74 ALSA_VER=$(get_pkg_ver alsa)
75 GNOME_VER=$(get_pkg_ver gnome)
76 GNOME_MINOR_VER=$(get_pkg_ver gnome-minor)
77 KDE_VER=$(get_pkg_ver kde)
[cac94f6]78 KDE_INST_VER=$(get_installed_ver kde)
[8b0d3b3]79 KDE_KOFFICE_VER=$(get_pkg_ver koffice)
80 XORG7_VER=$(get_pkg_ver xorg7)
81
[cac94f6]82 # Meta-packages installed version
83 ALSA_INST_VER=$(get_installed_ver alsa)
84 GNOME_INST_VER=$(get_installed_ver gnome)
85 KDE_INST_VER=$(get_installed_ver kde)
86 KDE_KOFFICE_INST_VER=$(get_installed_ver koffice)
87 XORG7_INST_VER=$(get_installed_ver xorg7)
88
[5769ccd]89 # Add header with meta-packages pseudo Id
90{
91 cat << EOF
[cac94f6]92alsa $BLFS_XML $ALSA_VER $ALSA_INST_VER
93gnome-core $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_INST_VER
94gnome-full $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_INST_VER
95kde-core $BLFS_XML $KDE_VER $KDE_INST_VER
96kde-full $BLFS_XML $KDE_VER $KDE_INST_VER
97kde-koffice $BLFS_XML $KDE_KOFFICE_VER $KDE_KOFFICE_INST
98xorg7 $BLFS_XML $XORG7_VER $XORG7_INST_VER
[5769ccd]99EOF
[ee8dc26]100} >> packages.tmp
[5769ccd]101
102 # Dump packages list
[ee8dc26]103 sort packages.tmp -b --key=2 --field-separator=/ --output=packages
[5769ccd]104
105 # Clean up
106 rm packages.tmp
107}
108
109# Pre-made *.dep files for meta-packages
110
111#--------------------------#
112generate_gnome_core() { # GNOME core
113#--------------------------#
114 local line base_xml package
115
116 > gnome-core.dep.tmp
117
118 for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do
119 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
120 package=`grep "gnome/core/$base_xml" packages | cut -f1`
121 [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp
122 done
123
[c704412]124 # Replace dummy packages with the proper ones
125 sed -i 's/GNOME-//g' gnome-core.dep.tmp
126
[2ca2992]127 tac gnome-core.dep.tmp > libs/gnome-core.dep
[5769ccd]128 rm gnome-core.dep.tmp
129}
130
[ea72d77]131#--------------------------#
132generate_gnome_full() { # GNOME full
133#--------------------------#
134 local line base_xml package
135
136 echo "gnome-core" > gnome-full.dep.tmp
137
138 for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do
139 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
140 package=`grep "gnome/add/$base_xml" packages | cut -f1`
141 [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp
142 done
143
[2ca2992]144 tac gnome-full.dep.tmp > libs/gnome-full.dep
[ea72d77]145 rm gnome-full.dep.tmp
146}
147
148#--------------------------#
149generate_kde_core() { # KDE core
150#--------------------------#
151 local line base_xml package
152
153 > kde-core.dep.tmp
154
155 for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do
156 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
157 package=`grep "kde/core/$base_xml" packages | cut -f1`
158 [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp
159 done
160
[2ca2992]161 tac kde-core.dep.tmp > libs/kde-core.dep
[ea72d77]162 rm kde-core.dep.tmp
163}
164
165#--------------------------#
166generate_kde_full() { # KDE full
167#--------------------------#
168 local line base_xml package
169
170 echo "kde-core" > kde-full.dep.tmp
171
172 for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do
173 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
174 package=`grep "kde/add/$base_xml" packages | cut -f1`
175 [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
176 done
177
178 for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do
179 base_xml=`echo $line | sed 's/^.*href="//;s/".*//'`
180 package=`grep "kde/devel/$base_xml" packages | cut -f1`
181 [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp
182 done
183
[2ca2992]184 tac kde-full.dep.tmp > libs/kde-full.dep
[ea72d77]185 rm kde-full.dep.tmp
186}
[323f805]187
188#--------------------------#
189generate_kde_koffice() { # KDE full + Koffice
190#--------------------------#
191 echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep
192}
193
194#--------------------------#
195generate_alsa() { # ALSA packages
196#--------------------------#
[2f16dbe]197 echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\
[323f805]198alsa-plugins\nalsa-lib" > libs/alsa.dep
199}
200
201#--------------------------#
202generate_xorg7() { # Xorg7 packages
203#--------------------------#
[2f16dbe]204 echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
205xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\
[323f805]206xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
207}
Note: See TracBrowser for help on using the repository browser.