Magellan Linux

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

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

revision 656 by niro, Sun Jan 13 21:42:16 2008 UTC revision 2195 by niro, Thu Oct 10 11:05:34 2013 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.8 2008-01-13 21:42:16 niro Exp $  
4    
5  # default die function  # default die function
6  die()  die()
# Line 22  die() Line 21  die()
21   source ${MLIBDIR}/mage4.functions.sh || \   source ${MLIBDIR}/mage4.functions.sh || \
22   die "mage functions missing"   die "mage functions missing"
23    
 # for tests only  
 # source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global  
 # source /etc/mage.rc  
 # source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh  
 # MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage  
   
 # not serious if missing, only needed for colors  
 [ -f /etc/init.d/functions ] && source /etc/init.d/functions  
   
 # disable colors if wanted  
 if [[ ${NOCOLORS} = true ]]  
 then  
  COLRED=""  
  COLGREEN=""  
  COLYELLOW=""  
  COLBLUE=""  
  COLMAGENTA=""  
  COLWHITE=""  
  COLDEFAULT=""  
 fi  
   
24  usage()  usage()
25  {  {
26   echo   echo
# Line 57  usage() Line 35  usage()
35   echo "                         install, srcinstall, depend, srcdepend"   echo "                         install, srcinstall, depend, srcdepend"
36   echo "                         upgrade, srcupgrade"   echo "                         upgrade, srcupgrade"
37   echo   echo
38   echo "method,name, version and build must be given !"   echo "method, name, version and build must be given !"
39   echo   echo
40   exit 1   exit 1
41  }  }
# Line 120  checklist_processeddeps() Line 98  checklist_processeddeps()
98  }  }
99    
100  #####################  #####################
101  ##  rumwandern /path/to/mage/file/.mage  ##  depwalking /path/to/mage/file/.mage
102  rumwandern()  depwalking()
103  {  {
104   unset DEPEND   unset DEPEND
105   unset SDEPEND   unset SDEPEND
# Line 143  rumwandern() Line 121  rumwandern()
121   DFILE="$1"   DFILE="$1"
122    
123   source ${DFILE}   source ${DFILE}
124    
125     # forced nodeps
126     if [[ ${NODEPS} = true ]]
127     then
128     DEPEND=""
129     SDEPEND=""
130     fi
131    
132   MY_DEPEND="${DEPEND}"   MY_DEPEND="${DEPEND}"
133    
134   # for srcinstall & srcdepend only; SDEPEND also needed   # for srcinstall & srcdepend only; SDEPEND also needed
# Line 185  rumwandern() Line 171  rumwandern()
171   fi   fi
172    
173   # mark depfile as processed to prevent double runs -without version   # mark depfile as processed to prevent double runs -without version
174   PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}"   # but do not add any virtuals to PROCESSEDDEPS or their resolved
175     # pkgnames will be ignored and they are missing on the dependecy-list
176     if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]]
177     then
178     PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}"
179     fi
180    
181   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")
182     if [[ -z ${HIGHEST_DEPFILE} ]]
183     then
184     INVALID_DEPS+=" ${DEPNAME}:${DFILE}"
185     continue
186     fi
187    
188   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"
189   PNAME="$(magename2pname ${HIGHEST_DEPFILE})"   PNAME="$(magename2pname ${HIGHEST_DEPFILE})"
190   PVER="$(magename2pver ${HIGHEST_DEPFILE})"   PVER="$(magename2pver ${HIGHEST_DEPFILE})"
191   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"
192    
193   ## check ob schon in ALLDEPS enthalten dann mach weiter   ## dep already in ALLDEPS? then going on
194    
195   # usage of fgrep is extremly slow and consumes a lot of cpu power   # usage of fgrep is extremly slow and consumes a lot of cpu power
196   #if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]   #if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]
197   if checklist_alldeps "${HIGHEST_DEPFILE}"   if checklist_alldeps "${HIGHEST_DEPFILE}"
198   then   then
199   ### check ob DFILE schon installiert ist ###   ### check if the dependency is already installed ###
200   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
201   then   then
202   rumwandern ${HIGHEST_DEPFILE}   depwalking ${HIGHEST_DEPFILE}
203   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"
204   fi   fi
205   fi   fi
# Line 213  EOF Line 209  EOF
209   return 0   return 0
210  }  }
211    
   
 ### abort if this package is already installed (retval 3)  
 # maybe later ?  
 #[ -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] && exit 3  
   
212  [[ ${METHOD} = pretend ]] || \  [[ ${METHOD} = pretend ]] || \
213   [[ ${METHOD} = srcpretend ]] || \   [[ ${METHOD} = srcpretend ]] || \
214   [[ ${METHOD} = uppretend ]] || \   [[ ${METHOD} = uppretend ]] || \
# Line 239  then Line 230  then
230   # get the highest mage file from mage-db   # get the highest mage file from mage-db
231   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"
232    
233     # if no install candidate was found, record this
234     # and process with the next one
235     if [[ -z ${MAGEFILE} ]]
236     then
237     NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"
238     continue
239     fi
240    
241   # now get the pver&pbuild from the new file   # now get the pver&pbuild from the new file
242   PVER="$(magename2pver ${MAGEFILE})"   PVER="$(magename2pver ${MAGEFILE})"
243   PBUILD="$(magename2pbuild ${MAGEFILE})"   PBUILD="$(magename2pbuild ${MAGEFILE})"
244    
245   # do not wander files which are installed   # do not walk files which are installed
246   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
247   then   then
248   # get dependencies the package   # get dependencies the package
249   rumwandern ${MAGEFILE}   depwalking ${MAGEFILE}
   
  # now add the package itself to the dependencies  
  # (if not exists already)  
  #if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ]  
  if checklist_alldeps "${MAGEFILE}"  
  then  
  ALLDEPS="${ALLDEPS} ${MAGEFILE}"  
  fi  
250   fi   fi
251   done   done
252  else  else
253   # get dependencies the package   # get all dependencies of the package
254   rumwandern ${MAGEFILE}   depwalking ${MAGEFILE}
255    fi
256    
257   # now add the package itself to the dependencies  # now add the package itself to the dependencies
258    # (if not exists already)
259    if checklist_alldeps "${MAGEFILE}"
260    then
261   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
262  fi  fi
263    
# Line 304  then Line 299  then
299   echo "done"   echo "done"
300   echo -e "${list}"   echo -e "${list}"
301   echo   echo
302    
303     if [[ ! -z ${INVALID_DEPS} ]]
304     then
305     echo -e "${COLRED}Invalid dependencies found:${COLDEFAULT}"
306     for i in ${INVALID_DEPS}
307     do
308     _dep="${i%%:*}"
309     _mage="${i##*:}"
310     echo -e "${COLRED} '${_dep}' -> '${_mage}'${COLDEFAULT}"
311     done
312     echo
313     fi
314    
315     if [[ ! -z ${NO_UPGRADE_CANDIDATE} ]]
316     then
317     echo -e "${COLRED}Currently no candidates found for:${COLDEFAULT}"
318     for i in ${NO_UPGRADE_CANDIDATE}
319     do
320     echo -e "${COLRED}    ${i}${COLDEFAULT}"
321     done
322     echo
323     echo -e "${COLRED}Please consider to uninstall all of them first,${COLDEFAULT}"
324     echo -e "${COLRED}because these packages does not exist in this distribution${COLDEFAULT}"
325     echo -e "${COLRED}anymore and there will be no further support for them.${COLDEFAULT}"
326     echo
327     fi
328  fi  fi
329    
330  ## return output from src/install deps  ## return output from src/install deps
# Line 312  fi Line 333  fi
333   [[ ${METHOD} = upgrade ]] || \   [[ ${METHOD} = upgrade ]] || \
334   [[ ${METHOD} = srcupgrade ]] && \   [[ ${METHOD} = srcupgrade ]] && \
335   echo "${ALLDEPS}"   echo "${ALLDEPS}"
   
 # delete ${BUILDDIR}/virtuals if exists as not needed anymore  
 #[ -d ${BUILDDIR}/virtuals ] && rm -rf ${BUILDDIR}/virtuals  

Legend:
Removed from v.656  
changed lines
  Added in v.2195