Magellan Linux

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

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

revision 2221 by niro, Wed Oct 16 07:40:02 2013 UTC revision 2285 by niro, Mon Dec 2 10:11:10 2013 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 27  usage() Line 35  usage()
35   echo "Usage: $(basename $0) [command] [arg] ..."   echo "Usage: $(basename $0) [command] [arg] ..."
36   echo   echo
37   echo "  -h     --help          shows this help"   echo "  -h     --help          shows this help"
38   echo "  -c     --pcat          categorie of the package"   echo "  -c     --pcat          category of the package"
39   echo "  -n     --pname         name of the package"   echo "  -n     --pname         name of the package"
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:"
  echo "  -d     --debug         enable debug mode"  
43   echo "                         install, srcinstall, depend, srcdepend"   echo "                         install, srcinstall, depend, srcdepend"
44   echo "                         upgrade, srcupgrade,"   echo "                         upgrade, srcupgrade,"
45   echo "                         install-build-prerequisites, pretend-build-prerequisites"   echo "                         install-build-prerequisites,"
46     echo "                         pretend-build-prerequisites"
47     echo "  -d     --debug         enable debug mode"
48   echo   echo
49   echo "method, name, version and build must be given !"   echo "method, category, name, version and build must be given !"
50   echo   echo
51   exit 1   exit 1
52  }  }
# Line 126  depwalking() Line 135  depwalking()
135    
136   DFILE="$1"   DFILE="$1"
137    
138     # debug info
139     decho "depwalking magefile '${DFILE}'"
140     decho
141    
142   source ${DFILE}   source ${DFILE}
143    
144   # forced nodeps   # forced nodeps
# Line 184  depwalking() Line 197  depwalking()
197    
198   if [ -z "${MY_DEPEND}" ]   if [ -z "${MY_DEPEND}" ]
199   then   then
200     decho "MY_DEPEND is empty; deps of '${DFILE}' ignored"
201   return 1   return 1
202   fi   fi
203    
204   while read SYM DEPNAME   while read SYM DEPNAME
205   do   do
206   if [[ ${DEBUG} = 1 ]]   # debug info
207   then   decho "DEPNAME='${DEPNAME}'"
  echo "DEBUG: DEPNAME='${DEPNAME}'" >&2  
  fi  
208    
209   # exclude empty depnames   # exclude empty depnames
210   [[ -z ${DEPNAME} ]] && continue   [[ -z ${DEPNAME} ]] && continue
# Line 234  depwalking() Line 246  depwalking()
246   then   then
247   depwalking ${HIGHEST_DEPFILE}   depwalking ${HIGHEST_DEPFILE}
248   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"   ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"
249     decho "added '${HIGHEST_DEPFILE}' to ALLDEPS"
250   fi   fi
251   fi   fi
252   done << EOF   done << EOF
# Line 264  then Line 277  then
277   # get the highest mage file from mage-db   # get the highest mage file from mage-db
278   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"   MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})"
279    
280     # debug info
281     decho "dep='${dep}'"
282     decho "PCAT='${PCAT}'"
283     decho "PNAME='${PNAME}'"
284     decho "MAGEFILE='${MAGEFILE}'"
285    
286   # if no install candidate was found, record this   # if no install candidate was found, record this
287   # and process with the next one   # and process with the next one
288   if [[ -z ${MAGEFILE} ]]   if [[ -z ${MAGEFILE} ]]
289   then   then
290   NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"   NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}"
291     decho "added to NO_UPGRADE_CANDIDATE"
292   continue   continue
293   fi   fi
294    
# Line 276  then Line 296  then
296   PVER="$(magename2pver ${MAGEFILE})"   PVER="$(magename2pver ${MAGEFILE})"
297   PBUILD="$(magename2pbuild ${MAGEFILE})"   PBUILD="$(magename2pbuild ${MAGEFILE})"
298    
299     # debug info
300     decho "PVER='${PVER}'"
301     decho "PBUILD='${PBUILD}'"
302    
303   # do not walk files which are installed   # do not walk files which are installed
304   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]   if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ]
305   then   then
306   # get dependencies the package   # get dependencies the package
307   depwalking ${MAGEFILE}   depwalking ${MAGEFILE}
308    
309     # now add the package itself to the dependencies
310     # (if not exists already)
311     if checklist_alldeps "${MAGEFILE}"
312     then
313     decho "added '${MAGEFILE}' to ALLDEPS"
314     ALLDEPS="${ALLDEPS} ${MAGEFILE}"
315     fi
316     else
317     # debug info
318     decho "ignored package"
319     decho
320     fi
321   fi   fi
322   done   done
323  else  else
# Line 290  else Line 327  else
327  fi  fi
328    
329  if [[ ${METHOD} != install-build-prerequisites ]] &&  if [[ ${METHOD} != install-build-prerequisites ]] &&
330   [[ ${METHOD} != pretend-build-prerequisites ]]   [[ ${METHOD} != pretend-build-prerequisites ]] &&
331     [[ ${METHOD} != upgrade ]] &&
332     [[ ${METHOD} != uppretend ]] &&
333     [[ ${METHOD} != srcupgrade ]] &&
334     [[ ${METHOD} != srcuppretend ]]
335  then  then
336   # now add the package itself to the dependencies   # now add the package itself to the dependencies
337   # (if not exists already)   # (if not exists already)
338   if checklist_alldeps "${MAGEFILE}"   if checklist_alldeps "${MAGEFILE}"
339   then   then
340     decho "added '${MAGEFILE}' to ALLDEPS"
341   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
342   fi   fi
343  fi  fi

Legend:
Removed from v.2221  
changed lines
  Added in v.2285