Magellan Linux

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

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

revision 2281 by niro, Wed Nov 20 12:21:28 2013 UTC revision 2359 by niro, Mon Jan 6 12:35:42 2014 UTC
# Line 9  die() Line 9  die()
9   exit 1   exit 1
10  }  }
11    
12    decho()
13    {
14     if [[ ${DEBUG} = 1 ]]
15     then
16     echo "DEBUG: $@" >&2
17     fi
18    }
19    
20  # include all needed files  # include all needed files
21  [ -f /etc/mage.rc.global ] &&  \  [ -f /etc/mage.rc.global ] &&  \
22   source /etc/mage.rc.global || \   source /etc/mage.rc.global || \
# Line 32  usage() Line 40  usage()
40   echo "  -v     --pver          version number of the package"   echo "  -v     --pver          version number of the package"
41   echo "  -b     --pbuild        build number of the package"   echo "  -b     --pbuild        build number of the package"
42   echo "  -m     --method        which calc method should be used:"   echo "  -m     --method        which calc method should be used:"
43   echo "                         install, srcinstall, depend, srcdepend"   echo "                         install, srcinstall, pretend, srcpretend"
44   echo "                         upgrade, srcupgrade,"   echo "                         upgrade, srcupgrade,"
45   echo "                         install-build-prerequisites,"   echo "                         install-build-prerequisites,"
46   echo "                         pretend-build-prerequisites"   echo "                         pretend-build-prerequisites"
# Line 127  depwalking() Line 135  depwalking()
135    
136   DFILE="$1"   DFILE="$1"
137    
138   if [[ ${DEBUG} = 1 ]]   # debug info
139   then   decho "depwalking magefile '${DFILE}'"
140   echo "DEBUG: depwalking magefile '${DFILE}'" >&2   decho
  echo >&2  
  fi  
141    
142   source ${DFILE}   source ${DFILE}
143    
# Line 145  depwalking() Line 151  depwalking()
151   MY_DEPEND="${DEPEND}"   MY_DEPEND="${DEPEND}"
152    
153   # for srcinstall & srcdepend only; SDEPEND also needed   # for srcinstall & srcdepend only; SDEPEND also needed
154   if [[ ${METHOD} = srcinstall ]] || \   if [[ ${METHOD} = srcinstall ]] ||
155   [[ ${METHOD} = srcpretend ]] || \   [[ ${METHOD} = srcpretend ]] ||
156   [[ ${METHOD} = srcupgrade ]] || \   [[ ${METHOD} = srcupgrade ]] ||
157   [[ ${METHOD} = srcuppretend ]]   [[ ${METHOD} = srcuppretend ]] ||
158     [[ ${METHOD} = install-build-prerequisites ]] ||
159     [[ ${METHOD} = pretend-build-prerequisites ]]
160   then   then
161   # only if SDEPEND is not zero   # only if SDEPEND is not zero
162   if [ -n "${SDEPEND}" ]   if [ -n "${SDEPEND}" ]
# Line 164  depwalking() Line 172  depwalking()
172   fi   fi
173   fi   fi
174    
  if [[ ${METHOD} = install-build-prerequisites ]] || \  
  [[ ${METHOD} = pretend-build-prerequisites ]]  
  then  
  # only one time  
  if [[ ${LOOP_COUNTER} -lt 1 ]]  
  then  
  # only if SDEPEND is not zero  
  if [ -n "${SDEPEND}" ]  
  then  
  # crlf is substantly needed !!  
  if [ -n "${MY_DEPEND}" ]  
  then  
  MY_DEPEND="${MY_DEPEND}  
  ${SDEPEND}"  
  else  
  MY_DEPEND="${SDEPEND}"  
  fi  
  fi  
  fi  
  LOOP_COUNTER=${LOOP_COUNTER}+1  
  fi  
   
175   unset DEPEND   unset DEPEND
176   unset SDEPEND   unset SDEPEND
177    
178   if [ -z "${MY_DEPEND}" ]   if [ -z "${MY_DEPEND}" ]
179   then   then
180   if [[ ${DEBUG} = 1 ]]   decho "MY_DEPEND is empty; deps of '${DFILE}' ignored"
  then  
  echo "DEBUG: MY_DEPEND is empty; deps of '${DFILE}' ignored" >&2  
  fi  
181   return 1   return 1
182   fi   fi
183    
184   while read SYM DEPNAME   while read SYM DEPNAME
185   do   do
186   if [[ ${DEBUG} = 1 ]]   # debug info
187   then   decho "DEPNAME='${DEPNAME}'"
  echo "DEBUG: DEPNAME='${DEPNAME}'" >&2  
  fi  
188    
189   # exclude empty depnames   # exclude empty depnames
190   [[ -z ${DEPNAME} ]] && continue   [[ -z ${DEPNAME} ]] && continue
# Line 245  depwalking() Line 226  depwalking()
226   then   then
227   depwalking ${HIGHEST_DEPFILE}   depwalking ${HIGHEST_DEPFILE}
228   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"
229   if [[ ${DEBUG} = 1 ]]   decho "added '${HIGHEST_DEPFILE}' to ALLDEPS"
  then  
  echo "DEBUG: added '${HIGHEST_DEPFILE}' to ALLDEPS" >&2  
  fi  
230   fi   fi
231   fi   fi
232   done << EOF   done << EOF
# Line 279  then Line 257  then
257   # get the highest mage file from mage-db   # get the highest mage file from mage-db
258   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"
259    
260   if [[ ${DEBUG} = 1 ]]   # debug info
261   then   decho "dep='${dep}'"
262   echo "DEBUG: dep='${dep}'" >&2   decho "PCAT='${PCAT}'"
263   echo "DEBUG: PCAT='${PCAT}'" >&2   decho "PNAME='${PNAME}'"
264   echo "DEBUG: PNAME='${PNAME}'" >&2   decho "MAGEFILE='${MAGEFILE}'"
  echo "DEBUG: MAGEFILE='${MAGEFILE}'" >&2  
  fi  
265    
266   # if no install candidate was found, record this   # if no install candidate was found, record this
267   # and process with the next one   # and process with the next one
268   if [[ -z ${MAGEFILE} ]]   if [[ -z ${MAGEFILE} ]]
269   then   then
270   NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"   NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"
271   if [[ ${DEBUG} = 1 ]]   decho "added to NO_UPGRADE_CANDIDATE"
  then  
  echo "DEBUG: added to NO_UPGRADE_CANDIDATE" >&2  
  fi  
272   continue   continue
273   fi   fi
274    
# Line 303  then Line 276  then
276   PVER="$(magename2pver ${MAGEFILE})"   PVER="$(magename2pver ${MAGEFILE})"
277   PBUILD="$(magename2pbuild ${MAGEFILE})"   PBUILD="$(magename2pbuild ${MAGEFILE})"
278    
279   if [[ ${DEBUG} = 1 ]]   # debug info
280   then   decho "PVER='${PVER}'"
281   echo "DEBUG: PVER='${PVER}'" >&2   decho "PBUILD='${PBUILD}'"
  echo "DEBUG: PBUILD='${PBUILD}'" >&2  
  fi  
282    
283   # do not walk files which are installed   # do not walk files which are installed
284   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
# Line 319  then Line 290  then
290   # (if not exists already)   # (if not exists already)
291   if checklist_alldeps "${MAGEFILE}"   if checklist_alldeps "${MAGEFILE}"
292   then   then
293   if [[ ${DEBUG} = 1 ]]   decho "added '${MAGEFILE}' to ALLDEPS"
  then  
  echo "DEBUG: added '${MAGEFILE}' to ALLDEPS" >&2  
  fi  
294   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
295   fi   fi
296   else   else
297   if [[ ${DEBUG} = 1 ]]   # debug info
298   then   decho "ignored package"
299   echo "DEBUG: ignored package" >&2   decho
  echo >&2  
300   fi   fi
301   fi   fi
302   done   done
# Line 350  then Line 317  then
317   # (if not exists already)   # (if not exists already)
318   if checklist_alldeps "${MAGEFILE}"   if checklist_alldeps "${MAGEFILE}"
319   then   then
320   if [[ ${DEBUG} = 1 ]]   decho "added '${MAGEFILE}' to ALLDEPS"
  then  
  echo "DEBUG: added '${MAGEFILE}' to ALLDEPS" >&2  
  fi  
321   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
322   fi   fi
323  fi  fi

Legend:
Removed from v.2281  
changed lines
  Added in v.2359