diff --git a/BLFS/libs/func_packages b/BLFS/libs/func_packages index 0d932a2..a9385e6 100644 --- a/BLFS/libs/func_packages +++ b/BLFS/libs/func_packages @@ -4,37 +4,80 @@ # set -e +#-----------------------# +get_pkg_ver() { # Find package version for a given package ID +#-----------------------# + local pkg_id=$1 + + case ${pkg_id} in + # ALSA packages version + alsa* ) pkg_id=alsa ;; + + # KDE packages version + kdevelop ) : ;; + kde*config ) : ;; + kde* ) pkg_id=kde ;; + + # Xorg7 packages version + xorg7-server ) pkg_id=xorg-server ;; + xterm2 ) pkg_id=xterm ;; + xorg7* ) pkg_id=xorg7 ;; + + # Others (ID value don't match entity name) + wireless_tools ) pkg_id=wireless-tools ;; + bind-utils ) pkg_id=bind ;; + html-tidy ) pkg_id=tidy ;; + jdk ) pkg_id=jdk-src ;; + reiserfs ) pkg_id=reiser ;; + xfs ) pkg_id=xfsprogs ;; + esac + + xmllint --noent ./blfs-xml/book/bookinfo.xml 2>/dev/null | \ + grep -i " ${pkg_id}-version " | cut -d "\"" -f2 + +} + #-----------------------# generate_packages() { # Master packages file #-----------------------# - local pkg_id file + local pkg_id file pkg_ver + local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER > packages.tmp # Extract Id and path for sect1 files for file in `find $BLFS_XML -name "*.xml"` ; do - pkg_id=`grep "sect1 id" $file | sed -e 's/> packages.tmp + pkg_id=$(grep "sect1 id" $file | sed -e 's/> packages.tmp done # IDs clean-up (unuseful pages or commented-out packages, could be more) sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp - sed -i '/fw-firewall/d;/gcc2/d;/cvsserver/d;/svnserver/d' packages.tmp + sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp + # Meta-packages version + ALSA_VER=$(get_pkg_ver alsa) + GNOME_VER=$(get_pkg_ver gnome) + GNOME_MINOR_VER=$(get_pkg_ver gnome-minor) + KDE_VER=$(get_pkg_ver kde) + KDE_KOFFICE_VER=$(get_pkg_ver koffice) + XORG7_VER=$(get_pkg_ver xorg7) + # Add header with meta-packages pseudo Id { cat << EOF -alsa $BLFS_XML -gnome-core $BLFS_XML -gnome-full $BLFS_XML -kde-core $BLFS_XML -kde-full $BLFS_XML -kde-koffice $BLFS_XML -xorg7 $BLFS_XML +alsa $BLFS_XML $ALSA_VER +gnome-core $BLFS_XML $GNOME_VER$GNOME_MINOR_VER +gnome-full $BLFS_XML $GNOME_VER$GNOME_MINOR_VER +kde-core $BLFS_XML $KDE_VER +kde-full $BLFS_XML $KDE_VER +kde-koffice $BLFS_XML $KDE_KOFFICE_VER +xorg7 $BLFS_XML $XORG7_VER EOF } >> packages.tmp diff --git a/BLFS/update_book.sh b/BLFS/update_book.sh index a04cfac..2812cb4 100755 --- a/BLFS/update_book.sh +++ b/BLFS/update_book.sh @@ -70,7 +70,7 @@ inline_doc BOOK_Source -echo -en "\n\tGenerating packages file ..." +echo -en "\n\tGenerating packages database file ..." generate_packages echo "done."