Magellan Linux

Diff of /branches/mage-next/src/depwalker.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 226 by niro, Fri Sep 9 16:35:46 2005 UTC revision 250 by niro, Sun Oct 2 13:57:39 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  #depwalker  #depwalker
4  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.1 2005-09-09 16:35:27 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.4 2005-10-02 13:57:39 niro Exp $
5    
6  # default die function  # default die function
7  die()  die()
# Line 10  die() Line 10  die()
10   exit 1   exit 1
11  }  }
12    
13  # # include all needed files  # include all needed files
14  # [ -f ${MLIBDIR}/conf/mage.rc.global ] &&  \  [ -f /etc/mage.rc.global ] &&  \
15  # source ${MLIBDIR}/conf/mage.rc.global || \   source /etc/mage.rc.global || \
16  # die "${MLIBDIR}/conf/mage.rc.global missing"   die "/etc/mage.rc.global missing"
17  #  
18  # [ -f /etc/mage.rc ] && source /etc/mage.rc || \  [ -f /etc/mage.rc ] && source /etc/mage.rc || \
19  # die "Your /etc/mage.rc is missing. Aborting."   die "Your /etc/mage.rc is missing. Aborting."
20  #  
21  # [ -f ${MLIBDIR}/mage.functions.sh ] && \  [ -f ${MLIBDIR}/mage4.functions.sh ] && \
22  # source ${MLIBDIR}/mage.functions.sh || \   source ${MLIBDIR}/mage4.functions.sh || \
23  # die "mage functions missing"   die "mage functions missing"
24    
25  # for tests only  # for tests only
26  source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global  # source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global
27  source /etc/mage.rc  # source /etc/mage.rc
28  source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh  # source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh
29    # MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage
30    
31  # not serios if missing, only for colors  # not serious if missing, only needed for colors
32  [ -f /etc/init.d/functions ] && source /etc/init.d/functions  [ -f /etc/init.d/functions ] && source /etc/init.d/functions
33    
34  # disable colors if wanted  # disable colors if wanted
# Line 53  usage() Line 54  usage()
54   echo "  -v     --pver          version number of the package"   echo "  -v     --pver          version number of the package"
55   echo "  -b     --pbuild        build number of the package"   echo "  -b     --pbuild        build number of the package"
56   echo "  -m     --method        which calc method should be used:"   echo "  -m     --method        which calc method should be used:"
57   echo "                         install srcinstall depend srcdepend"   echo "                         install, srcinstall, depend, srcdepend"
58     echo "                         upgrade, srcupgrade"
59   echo   echo
60   echo "method,name, version and build must be given !"   echo "method,name, version and build must be given !"
61   echo   echo
# Line 108  rumwandern() Line 110  rumwandern()
110   local INSTALL_VIRTUAL   local INSTALL_VIRTUAL
111   local PNAME   local PNAME
112   local PCAT   local PCAT
113     local PVER
114     local PBUILD
115    
116   DFILE="$1"   DFILE="$1"
117    
# Line 115  rumwandern() Line 119  rumwandern()
119   MY_DEPEND="${DEPEND}"   MY_DEPEND="${DEPEND}"
120    
121   # for srcinstall & srcdepend only; SDEPEND also needed   # for srcinstall & srcdepend only; SDEPEND also needed
122   if [[ ${METHOD} = srcinstall ]] || [[ ${METHOD} = srcpretend ]]   if [[ ${METHOD} = srcinstall ]] || \
123     [[ ${METHOD} = srcpretend ]] || \
124     [[ ${METHOD} = srcupgrade ]] || \
125     [[ ${METHOD} = srcuppretend ]]
126   then   then
127   # only if SDEPEND is not zero   # only if SDEPEND is not zero
128   if [ -n "${SDEPEND}" ]   if [ -n "${SDEPEND}" ]
# Line 169  EOF Line 176  EOF
176  # maybe later ?  # maybe later ?
177  #[ -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] && exit 3  #[ -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] && exit 3
178    
179  [[ ${METHOD} = pretend ]] || [[ ${METHOD} = srcpretend ]] && \  [[ ${METHOD} = pretend ]] || \
180     [[ ${METHOD} = srcpretend ]] || \
181     [[ ${METHOD} = uppretend ]] || \
182     [[ ${METHOD} = srcuppretend ]] && \
183   echo -n "Calculating dependencies ... "   echo -n "Calculating dependencies ... "
184    
 # get dependencies the package  
 rumwandern ${MAGEFILE}  
185    
186  [[ ${METHOD} = pretend ]] || [[ ${METHOD} = srcpretend ]] && echo "done"  if [[ ${METHOD} = upgrade ]] || \
187     [[ ${METHOD} = srcupgrade ]] || \
188     [[ ${METHOD} = uppretend ]] || \
189     [[ ${METHOD} = srcuppretend ]]
190    then
191     INSTDEPS="$(${MLIBDIR}/magequery.sh -i)"
192     for dep in ${INSTDEPS}
193     do
194     PCAT="$(magename2pcat ${dep} installdb)"
195     PNAME="$(magename2pname ${dep})"
196    
197     # get the highest mage file from mage-db
198     MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"
199    
200     # now get the pver&pbuild from the new file
201     PVER="$(magename2pver ${MAGEFILE})"
202     PBUILD="$(magename2pbuild ${MAGEFILE})"
203    
204     # do not wander files which are installed
205     if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
206     then
207     # get dependencies the package
208     rumwandern ${MAGEFILE}
209    
210     # now add the package itself to the dependencies
211     # (if not exists already)
212     if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ]
213     then
214     ALLDEPS="${ALLDEPS} ${MAGEFILE}"
215     fi
216     fi
217     done
218    else
219     # get dependencies the package
220     rumwandern ${MAGEFILE}
221    
222     # now add the package itself to the dependencies
223     ALLDEPS="${ALLDEPS} ${MAGEFILE}"
224    fi
225    
226    [[ ${METHOD} = pretend ]] || \
227     [[ ${METHOD} = srcpretend ]] || \
228     [[ ${METHOD} = uppretend ]] || \
229     [[ ${METHOD} = srcuppretend ]] && \
230     echo "done"
231    
 # now add the package itself to the dependencies  
 ALLDEPS="${ALLDEPS} ${MAGEFILE}"  
232    
233  ## show output of pretend  ## show output of pretend
234  if [[ ${METHOD} = pretend ]] || [[ ${METHOD} = srcpretend ]]  if [[ ${METHOD} = pretend ]] || \
235     [[ ${METHOD} = srcpretend ]] || \
236     [[ ${METHOD} = uppretend ]] || \
237     [[ ${METHOD} = srcuppretend ]]
238  then  then
239   # this is a little bit faster   # this is a little bit faster
240   declare -i x=0   declare -i x=0
# Line 212  then Line 264  then
264  fi  fi
265    
266  ## return output from src/install deps  ## return output from src/install deps
267  [[ ${METHOD} = install ]] || [[ ${METHOD} = srcinstall ]] && echo "${ALLDEPS}"  [[ ${METHOD} = install ]] || \
268     [[ ${METHOD} = srcinstall ]] || \
269     [[ ${METHOD} = upgrade ]] || \
270     [[ ${METHOD} = srcupgrade ]] && \
271     echo "${ALLDEPS}"
272    
273  # delete ${BUILDDIR}/virtuals if exists as not needed anymore  # delete ${BUILDDIR}/virtuals if exists as not needed anymore
274  #[ -d ${BUILDDIR}/virtuals ] && rm -rf ${BUILDDIR}/virtuals  #[ -d ${BUILDDIR}/virtuals ] && rm -rf ${BUILDDIR}/virtuals

Legend:
Removed from v.226  
changed lines
  Added in v.250