1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Id$ |
# $Id$ |
3 |
# dependeny walker |
# dependency walker |
4 |
|
|
5 |
# default die function |
# set default variables |
6 |
die() |
: ${MAGERC="@@SYSCONFDIR@@/mage.rc"} |
7 |
{ |
: ${MLIBDIR="@@MAGELIBDIR@@"} |
8 |
echo ${COLRED}"$@"${COLDEFAULT} |
|
9 |
exit 1 |
# first of all include common functions |
10 |
} |
source ${MLIBDIR}/common.functions.sh || exit 1 |
11 |
|
source @@SYSCONFDIR@@/mage.rc.global || die "@@SYSCONFDIR@@/mage.rc.global missing" |
12 |
|
source ${MAGERC} || die "Your ${MAGERC} is missing. Aborting." |
13 |
|
source ${MLIBDIR}/mage4.functions.sh || die "mage functions missing" |
14 |
|
source ${MLIBDIR}/smage2.functions.sh || die "smage functions missing" |
15 |
|
|
16 |
decho() |
decho() |
17 |
{ |
{ |
21 |
fi |
fi |
22 |
} |
} |
23 |
|
|
|
# include all needed files |
|
|
[ -f /etc/mage.rc.global ] && \ |
|
|
source /etc/mage.rc.global || \ |
|
|
die "/etc/mage.rc.global missing" |
|
|
|
|
|
[ -f ${MAGERC} ] && source ${MAGERC} || \ |
|
|
die "Your ${MAGERC} is missing. Aborting." |
|
|
|
|
|
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
|
|
source ${MLIBDIR}/mage4.functions.sh || \ |
|
|
die "mage functions missing" |
|
|
|
|
|
[ -f ${MLIBDIR}/smage2.functions.sh ] && \ |
|
|
source ${MLIBDIR}/smage2.functions.sh || \ |
|
|
die "smage functions missing" |
|
|
|
|
24 |
usage() |
usage() |
25 |
{ |
{ |
26 |
echo |
echo |
44 |
exit 1 |
exit 1 |
45 |
} |
} |
46 |
|
|
47 |
# always default debug=0 |
# set some sane defaults |
48 |
DEBUG=0 |
DEBUG=0 |
49 |
|
SMAGE_DEPEND=0 |
50 |
|
|
51 |
# very basic getops |
# very basic getops |
52 |
for i in $* |
for i in $* |
58 |
--pbuild|-b) shift; PBUILD="$1" ;; |
--pbuild|-b) shift; PBUILD="$1" ;; |
59 |
--method|-m) shift; METHOD="$1" ;; |
--method|-m) shift; METHOD="$1" ;; |
60 |
--debug|-d) shift; DEBUG=1 ;; |
--debug|-d) shift; DEBUG=1 ;; |
61 |
--smage|-s) shift; SMAGEFILE="$1"; SILENT=1; FVERBOSE=off ;; |
--smage|-s) shift; SMAGEFILE="$1"; SMAGE_DEPEND=1; SILENT=1; FVERBOSE=off ;; |
62 |
--help|-h) usage ;; |
--help|-h) usage ;; |
63 |
esac |
esac |
64 |
shift |
shift |
204 |
|
|
205 |
# mark depfile as processed to prevent double runs -without version |
# mark depfile as processed to prevent double runs -without version |
206 |
# but do not add any virtuals to PROCESSEDDEPS or their resolved |
# but do not add any virtuals to PROCESSEDDEPS or their resolved |
207 |
# pkgnames will be ignored and they are missing on the dependecy-list |
# pkgnames will be ignored and they are missing on the dependency-list |
208 |
if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]] |
if [[ ${DEPNAME/virtual\//} = ${DEPNAME} ]] |
209 |
then |
then |
210 |
PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}" |
PROCESSEDDEPS="${PROCESSEDDEPS} ${DEPNAME%-*}" |
231 |
### check if the dependency is already installed ### |
### check if the dependency is already installed ### |
232 |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
233 |
then |
then |
234 |
|
# but first get all deps of highest_depfile to catch all dependencies of it |
235 |
depwalking ${HIGHEST_DEPFILE} |
depwalking ${HIGHEST_DEPFILE} |
236 |
ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" |
ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" |
237 |
decho "added '${HIGHEST_DEPFILE}' to ALLDEPS" |
decho "added '${HIGHEST_DEPFILE}' to ALLDEPS" |