Magellan Linux

Diff of /trunk/mage/usr/lib/mage/depwalker.sh

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

revision 250 by niro, Sun Oct 2 13:57:39 2005 UTC revision 654 by niro, Sun Jan 13 21:32:38 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.4 2005-10-02 13:57:39 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.7 2008-01-13 21:32:38 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 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 148  rumwandern() Line 175  rumwandern()
175    
176   while read SYM DEPNAME   while read SYM DEPNAME
177   do   do
178     # exclude all already processed deps -without version
179     if ! checklist_processeddeps "${DEPNAME%-*}"
180     then
181     continue
182     fi
183    
184     # mark depfile as processed to prevent double runs -without version
185     PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}"
186    
187   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")   HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}")
188    
189   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"   PCAT="$(magename2pcat ${HIGHEST_DEPFILE})"
# Line 156  rumwandern() Line 192  rumwandern()
192   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"   PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})"
193    
194   ## check ob schon in ALLDEPS enthalten dann mach weiter   ## check ob schon in ALLDEPS enthalten dann mach weiter
195   if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]  
196     # usage of fgrep is extremly slow and consumes a lot of cpu power
197     #if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ]
198     if checklist_alldeps "${HIGHEST_DEPFILE}"
199   then   then
200   ### check ob DFILE schon installiert ist ###   ### check ob DFILE schon installiert ist ###
201   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
# Line 209  then Line 248  then
248    
249   # now add the package itself to the dependencies   # now add the package itself to the dependencies
250   # (if not exists already)   # (if not exists already)
251   if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ]   #if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ]
252     if checklist_alldeps "${MAGEFILE}"
253   then   then
254   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
255   fi   fi

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