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