Magellan Linux

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

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

revision 235 by niro, Sat Sep 10 13:34:56 2005 UTC revision 1559 by niro, Wed Dec 28 09:54:25 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    # $Id$
3  #depwalker  # dependeny walker
 # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.3 2005-09-10 13:34:56 niro Exp $  
4    
5  # default die function  # default die function
6  die()  die()
# Line 15  die() Line 14  die()
14   source /etc/mage.rc.global || \   source /etc/mage.rc.global || \
15   die "/etc/mage.rc.global missing"   die "/etc/mage.rc.global missing"
16    
17  [ -f /etc/mage.rc ] && source /etc/mage.rc || \  [ -f ${MAGERC} ] && source ${MAGERC} || \
18   die "Your /etc/mage.rc is missing. Aborting."   die "Your ${MAGERC} is missing. Aborting."
19    
20  [ -f ${MLIBDIR}/mage4.functions.sh ] && \  [ -f ${MLIBDIR}/mage4.functions.sh ] && \
21   source ${MLIBDIR}/mage4.functions.sh || \   source ${MLIBDIR}/mage4.functions.sh || \
# Line 57  usage() Line 56  usage()
56   echo "                         install, srcinstall, depend, srcdepend"   echo "                         install, srcinstall, depend, srcdepend"
57   echo "                         upgrade, srcupgrade"   echo "                         upgrade, srcupgrade"
58   echo   echo
59   echo "method,name, version and build must be given !"   echo "method, name, version and build must be given !"
60   echo   echo
61   exit 1   exit 1
62  }  }
# Line 92  done Line 91  done
91  ALLDEPS=""  ALLDEPS=""
92  MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage"  MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage"
93    
94    # much faster than fgrep
95    checklist_alldeps()
96    {
97     local i
98     local item="$1"
99    
100     for i in ${ALLDEPS}
101     do
102     [[ ${i} = ${item} ]] && return 1
103     done
104    
105     return 0
106    }
107    
108    checklist_processeddeps()
109    {
110     local i
111     local item="$1"
112    
113     for i in ${PROCESSEDDEPS}
114     do
115     [[ ${i} = ${item} ]] && return 1
116     done
117    
118     return 0
119    }
120    
121  #####################  #####################
122  ##  rumwandern /path/to/mage/file/.mage  ##  rumwandern /path/to/mage/file/.mage
123  rumwandern()  rumwandern()
# Line 110  rumwandern() Line 136  rumwandern()
136   local INSTALL_VIRTUAL   local INSTALL_VIRTUAL
137   local PNAME   local PNAME
138   local PCAT   local PCAT
139     local PVER
140     local PBUILD
141    
142   DFILE="$1"   DFILE="$1"
143    
144   source ${DFILE}   source ${DFILE}
145    
146     # forced nodeps
147     if [[ ${NODEPS} = true ]]
148     then
149     DEPEND=""
150     SDEPEND=""
151     fi
152    
153   MY_DEPEND="${DEPEND}"   MY_DEPEND="${DEPEND}"
154    
155   # for srcinstall & srcdepend only; SDEPEND also needed   # for srcinstall & srcdepend only; SDEPEND also needed
# Line 146  rumwandern() Line 182  rumwandern()
182    
183   while read SYM DEPNAME   while read SYM DEPNAME
184   do   do
185     # exclude empty depnames
186     [[ -z ${DEPNAME} ]] && continue
187    
188     # exclude all already processed deps -without version
189     if ! checklist_processeddeps "${DEPNAME%-*}"
190     then
191     continue
192     fi
193    
194     # mark depfile as processed to prevent double runs -without version
195     # but do not add any virtuals to PROCESSEDDEPS or their resolved
196     # pkgnames will be ignored and they are missing on the dependecy-list
197     if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]]
198     then
199     PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}"
200     fi
201    
202   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")
203    
204   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"
# Line 154  rumwandern() Line 207  rumwandern()
207   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"
208    
209   ## check ob schon in ALLDEPS enthalten dann mach weiter   ## check ob schon in ALLDEPS enthalten dann mach weiter
210   if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]  
211     # usage of fgrep is extremly slow and consumes a lot of cpu power
212     #if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]
213     if checklist_alldeps "${HIGHEST_DEPFILE}"
214   then   then
215   ### check ob DFILE schon installiert ist ###   ### check ob DFILE schon installiert ist ###
216   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
# Line 191  then Line 247  then
247   do   do
248   PCAT="$(magename2pcat ${dep} installdb)"   PCAT="$(magename2pcat ${dep} installdb)"
249   PNAME="$(magename2pname ${dep})"   PNAME="$(magename2pname ${dep})"
  PVER="$(magename2pver ${dep})"  
  PBUILD="$(magename2pbuild ${dep})"  
250    
251   # fake a mage file   # get the highest mage file from mage-db
252   MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage"   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"
253    
254   rumwandern ${MAGEFILE}   # if no install candidate was found, record this
255     # and process with the next one
256     if [[ -z ${MAGEFILE} ]]
257     then
258     NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"
259     continue
260     fi
261    
262     # now get the pver&pbuild from the new file
263     PVER="$(magename2pver ${MAGEFILE})"
264     PBUILD="$(magename2pbuild ${MAGEFILE})"
265    
266     # do not wander files which are installed
267     if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
268     then
269     # get dependencies the package
270     rumwandern ${MAGEFILE}
271    
272     # now add the package itself to the dependencies
273     # (if not exists already)
274     #if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ]
275     if checklist_alldeps "${MAGEFILE}"
276     then
277     ALLDEPS="${ALLDEPS} ${MAGEFILE}"
278     fi
279     fi
280   done   done
281  else  else
282   # get dependencies the package   # get dependencies the package
# Line 245  then Line 324  then
324   echo "done"   echo "done"
325   echo -e "${list}"   echo -e "${list}"
326   echo   echo
327    
328     if [[ ! -z ${NO_UPGRADE_CANDIDATE} ]]
329     then
330     echo -e "${COLRED}Currently no candidates found for:${COLDEFAULT}"
331     for i in ${NO_UPGRADE_CANDIDATE}
332     do
333     echo -e "${COLRED}    ${i}${COLDEFAULT}"
334     done
335     echo
336     echo -e "${COLRED}Please consider to uninstall all of them first,${COLDEFAULT}"
337     echo -e "${COLRED}because these packages does not exist in this distribution${COLDEFAULT}"
338     echo -e "${COLRED}anymore and there will be no further support for them.${COLDEFAULT}"
339     echo
340     fi
341  fi  fi
342    
343  ## return output from src/install deps  ## return output from src/install deps

Legend:
Removed from v.235  
changed lines
  Added in v.1559