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.6 2007-11-05 16:49:33 niro Exp $ |
|
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
56 |
echo " install, srcinstall, depend, srcdepend" |
echo " install, srcinstall, depend, srcdepend" |
57 |
echo " upgrade, srcupgrade" |
echo " upgrade, srcupgrade" |
58 |
echo |
echo |
59 |
echo "method,name, version and build must be given !" |
echo "method, name, version and build must be given !" |
60 |
echo |
echo |
61 |
exit 1 |
exit 1 |
62 |
} |
} |
105 |
return 0 |
return 0 |
106 |
} |
} |
107 |
|
|
108 |
|
checklist_processeddeps() |
109 |
|
{ |
110 |
|
local i |
111 |
|
local item="$1" |
112 |
|
|
113 |
|
for i in ${PROCESSEDDEPS} |
114 |
|
do |
115 |
|
[[ ${i} = ${item} ]] && return 1 |
116 |
|
done |
117 |
|
|
118 |
|
return 0 |
119 |
|
} |
120 |
|
|
121 |
##################### |
##################### |
122 |
## rumwandern /path/to/mage/file/.mage |
## rumwandern /path/to/mage/file/.mage |
123 |
rumwandern() |
rumwandern() |
142 |
DFILE="$1" |
DFILE="$1" |
143 |
|
|
144 |
source ${DFILE} |
source ${DFILE} |
145 |
|
|
146 |
|
# forced nodeps |
147 |
|
if [[ ${NODEPS} = true ]] |
148 |
|
then |
149 |
|
DEPEND="" |
150 |
|
SDEPEND="" |
151 |
|
fi |
152 |
|
|
153 |
MY_DEPEND="${DEPEND}" |
MY_DEPEND="${DEPEND}" |
154 |
|
|
155 |
# for srcinstall & srcdepend only; SDEPEND also needed |
# for srcinstall & srcdepend only; SDEPEND also needed |
182 |
|
|
183 |
while read SYM DEPNAME |
while read SYM DEPNAME |
184 |
do |
do |
185 |
|
# exclude empty depnames |
186 |
|
[[ -z ${DEPNAME} ]] && continue |
187 |
|
|
188 |
|
# exclude all already processed deps -without version |
189 |
|
if ! checklist_processeddeps "${DEPNAME%-*}" |
190 |
|
then |
191 |
|
continue |
192 |
|
fi |
193 |
|
|
194 |
|
# mark depfile as processed to prevent double runs -without version |
195 |
|
# but do not add any virtuals to PROCESSEDDEPS or their resolved |
196 |
|
# pkgnames will be ignored and they are missing on the dependecy-list |
197 |
|
if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]] |
198 |
|
then |
199 |
|
PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}" |
200 |
|
fi |
201 |
|
|
202 |
HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}") |
HIGHEST_DEPFILE=$(dep2highest_magefile "${DEPNAME}") |
203 |
|
|
204 |
PCAT="$(magename2pcat ${HIGHEST_DEPFILE})" |
PCAT="$(magename2pcat ${HIGHEST_DEPFILE})" |
251 |
# get the highest mage file from mage-db |
# get the highest mage file from mage-db |
252 |
MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})" |
MAGEFILE="$(get_highest_magefile ${PCAT} ${PNAME})" |
253 |
|
|
254 |
|
# if no install candidate was found, record this |
255 |
|
# and process with the next one |
256 |
|
if [[ -z ${MAGEFILE} ]] |
257 |
|
then |
258 |
|
NO_UPGRADE_CANDIDATE="${NO_UPGRADE_CANDIDATE} ${PCAT}/${PNAME}" |
259 |
|
continue |
260 |
|
fi |
261 |
|
|
262 |
# now get the pver&pbuild from the new file |
# now get the pver&pbuild from the new file |
263 |
PVER="$(magename2pver ${MAGEFILE})" |
PVER="$(magename2pver ${MAGEFILE})" |
264 |
PBUILD="$(magename2pbuild ${MAGEFILE})" |
PBUILD="$(magename2pbuild ${MAGEFILE})" |
324 |
echo "done" |
echo "done" |
325 |
echo -e "${list}" |
echo -e "${list}" |
326 |
echo |
echo |
327 |
|
|
328 |
|
if [[ ! -z ${NO_UPGRADE_CANDIDATE} ]] |
329 |
|
then |
330 |
|
echo -e "${COLRED}Currently no candidates found for:${COLDEFAULT}" |
331 |
|
for i in ${NO_UPGRADE_CANDIDATE} |
332 |
|
do |
333 |
|
echo -e "${COLRED} ${i}${COLDEFAULT}" |
334 |
|
done |
335 |
|
echo |
336 |
|
echo -e "${COLRED}Please consider to uninstall all of them first,${COLDEFAULT}" |
337 |
|
echo -e "${COLRED}because these packages does not exist in this distribution${COLDEFAULT}" |
338 |
|
echo -e "${COLRED}anymore and there will be no further support for them.${COLDEFAULT}" |
339 |
|
echo |
340 |
|
fi |
341 |
fi |
fi |
342 |
|
|
343 |
## return output from src/install deps |
## return output from src/install deps |