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

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