source: BLFS/func_dependencies@ 1d2f9d4

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

Added prototipe files for new BLFS module.

  • Property mode set to 100644
File size: 6.0 KB
RevLine 
[1d2f9d4]1#!/bin/bash
2#
3# $Id$
4#
5set -e
6
7#-----------------------#
8do_dependencies() { # Loop to find sub-dependencies
9#-----------------------#
10 set -e
11 local PKG=$1
12 local saveIFS=$IFS
13 local DEP_LV=$DEP_LEVEL
14 local line line2 DEP
15
16 echo -e "\tPKG is $PKG" >> depure.txt
17 echo -e "\tDEP_LEVEL for $PKG is $DEP_LV\n" >> depure.txt
18
19 # If a premade xinclude file esist, use it. If not, create one
20 if [[ -f xincludes/$PKG.xinc ]] ; then
21 echo -e "\tReusing xinclude file for PKG $PKG" >> depure.txt
22 IFS=$'\x0A'
23 for line in `cat xincludes/$PKG.xinc` ; do
24 IFS=$saveIFS
25 # Remove the Xinclude entry if found. We want the most newer one.
26 # Using double quotes to let bash expand variables.
27 # Remove also the empty line created. Can not be done in one step
28 # due that d requires the pattner between /, but we have a lot of /
29 # inside the pattner.
30 sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
31 # Write the XInclude
32 echo -e "$line" >> $TARGET-index.xml.tmp
33 done
34 else
35 # Start with a clean $PKG.xinc.tmp file
36 > xincludes/$PKG.xinc.tmp
37 for DEP in `cat dependencies/$PKG.dep`; do
38 # Especial packages (a lot of hacks)
39 case $DEP in
40 # The proper version of DB is installed in LFS
41 db ) continue ;;
42 # ID value don't have their own XML package file
43 hal-requirements ) continue ;;
44 perl-* | tk-perl ) DEP=perl-modules ;;
45 # Orphan links (proper link must be created when generating the book)
46 arts ) DEP=aRts ;; # That should be fixed in the BLFS book
47 # Set values for alternative packages
48 # X is a meta-package, thus handled in another way.
49 LPRng | cups ) DEP=$PRINT_SERVER ;;
50 mitkrb | heimdal ) DEP=$KBR5 ;;
51 gs | espgs ) DEP=$GHOSTSCRIPT ;;
52 MTA ) DEP=$MAIL_SERVER ;; # The BLFS book need be fixed yet for that
53 esac
54 echo -e "\tDEP for $PKG is $DEP" >> depure.txt
55 case $DEP in
56 # Circular dependencies at level 3
57 cracklib | docbook-utils | libxml2 | cyrus-sasl | alsa-lib | \
58 unixodbc | cups | libexif | esound | gimp )
59 [[ "$DEP_LV" = "3" ]] && DEP_LV=2
60 ;;
61 * ) DEP_LV=$DEP_LEVEL ;;
62 esac
63 echo -e "\tDEP_LEVEL for $DEP is $DEP_LV" >> depure.txt
64 # XML file of dependency package
65 DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
66 echo -e "\t\tDEP_XML is $DEP_XML\n" >> depure.txt
67 case $DEP in
68 x-window-system ) ;; # No page for that (proper link must be created when generating the book)
69 xorg7 ) ;; # This page will be dump in the xorg7.xinc file
70 * )
71 # Remove the Xinclude entry if found
72 sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
73 -e '/./!d' -i xincludes/$PKG.xinc.tmp
74 # Write the XInclude
75 echo -e " $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
76 ;;
77 esac
78 # If not already created, create its dependencies list
79 if [[ ! -f dependencies/$DEP.dep ]] ; then
80 case $DEP in
81 # Meta-packages at dependency level (ugly *.dep files, but work for now)
82 alsa ) # When dependency "alsa", use all alsa-* packages
83 echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
84 alsa-plugins\nalsa-lib" > dependencies/$DEP.dep
85 ;;
86 x-window-system ) # X11 alternatives
87 echo -e "x-config\nx-setup\n$X11" > dependencies/$DEP.dep
88 ;;
89 xorg7 ) # All Xorg7 packages except Xterm (circular dependency)
90 echo -e "rman\nxorg7-driver\nxorg7-server\nluit\nxorg7-font\n \
91 xorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \
92 xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/$DEP.dep
93 ;;
94 * ) xsltproc --stringparam dependencies $DEP_LV \
95 -o dependencies/$DEP.dep ../dependencies.xsl ../$DEP_XML
96 ;;
97 esac
98 fi
99 # If needed, process its dependencies
100 if [[ -f dependencies/$DEP.dep ]] ; then
101 # If a premade xinclude file esist, include it
102 if [[ -f xincludes/$DEP.xinc ]] ; then
103 echo -e "\tReusing xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
104 IFS=$'\x0A'
105 for line2 in `cat xincludes/$DEP.xinc` ; do
106 IFS=$saveIFS
107 # Remove the Xinclude entry if found
108 sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
109 # Write the XInclude
110 echo -e "$line2" >> xincludes/$PKG.xinc.tmp
111 done
112 # Create the xinclude file
113 else
114 # We will call the function from inside it
115 echo -e "\nStart new loop for PKG $DEP (to solve $PKG)\n" >> depure.txt
116 # We will call the function from inside it
117 set +e
118 do_dependencies $DEP
119 set -e
120 # Include it when done
121 echo -e "\tUsing the new xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
122 IFS=$'\x0A'
123 for line2 in `cat xincludes/$DEP.xinc` ; do
124 IFS=$saveIFS
125 # Remove the Xinclude entry if found
126 sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
127 # Write the XInclude
128 echo -e "$line2" >> xincludes/$PKG.xinc.tmp
129 done
130 fi
131 fi
132 done
133 if [[ "$PKG" = "xorg7" ]] ; then
134 # Add their XInclude
135 PKG_XML=`grep "^$PKG[[:space:]]" ../packages | cut -f2`
136 echo -e " $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
137 fi
138 mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
139 echo -e "Using the new xinclude file for PKG $PKG" >> depure.txt
140 IFS=$'\x0A'
141 for line in `cat xincludes/$PKG.xinc` ; do
142 IFS=$saveIFS
143 # Remove the Xinclude entry if found.
144 sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
145 # Write the XInclude
146 echo -e "$line" >> $TARGET-index.xml.tmp
147 done
148 fi
149
150 echo -e "\nEnd loop for PKG $PKG\n" >> depure.txt
151}
Note: See TracBrowser for help on using the repository browser.