Magellan Linux

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

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

trunk/mage/usr/lib/mage/depwalker.sh revision 2359 by niro, Mon Jan 6 12:35:42 2014 UTC branches/mage-next/src/depwalker.in revision 2626 by niro, Wed Mar 5 08:16:25 2014 UTC
# Line 2  Line 2 
2  # $Id$  # $Id$
3  # dependeny walker  # dependeny walker
4    
 # default die function  
 die()  
 {  
  echo ${COLRED}"$@"${COLDEFAULT}  
  exit 1  
 }  
   
5  decho()  decho()
6  {  {
7   if [[ ${DEBUG} = 1 ]]   if [[ ${DEBUG} = 1 ]]
# Line 17  decho() Line 10  decho()
10   fi   fi
11  }  }
12    
13  # include all needed files  # first of all include common functions
14  [ -f /etc/mage.rc.global ] &&  \  source ${MLIBDIR}/common.functions.sh || exit 1
15   source /etc/mage.rc.global || \  source @@SYSCONFDIR@@/mage.rc.global || die "@@SYSCONFDIR@@/mage.rc.global missing"
16   die "/etc/mage.rc.global missing"  source ${MAGERC} || die "Your ${MAGERC} is missing. Aborting."
17    source ${MLIBDIR}/mage4.functions.sh || die "mage functions missing"
18  [ -f ${MAGERC} ] && source ${MAGERC} || \  source ${MLIBDIR}/smage2.functions.sh || die "smage functions missing"
  die "Your ${MAGERC} is missing. Aborting."  
   
 [ -f ${MLIBDIR}/mage4.functions.sh ] && \  
  source ${MLIBDIR}/mage4.functions.sh || \  
  die "mage functions missing"  
19    
20  usage()  usage()
21  {  {
# Line 45  usage() Line 33  usage()
33   echo "                         install-build-prerequisites,"   echo "                         install-build-prerequisites,"
34   echo "                         pretend-build-prerequisites"   echo "                         pretend-build-prerequisites"
35   echo "  -d     --debug         enable debug mode"   echo "  -d     --debug         enable debug mode"
36     echo "  -s     --smage         use a smage to calculate dependencies"
37   echo   echo
38   echo "method, category, name, version and build must be given !"   echo "method, category, name, version and build must be given !"
39   echo   echo
# Line 64  do Line 53  do
53   --pbuild|-b) shift; PBUILD="$1" ;;   --pbuild|-b) shift; PBUILD="$1" ;;
54   --method|-m) shift; METHOD="$1" ;;   --method|-m) shift; METHOD="$1" ;;
55   --debug|-d) shift; DEBUG=1 ;;   --debug|-d) shift; DEBUG=1 ;;
56     --smage|-s) shift; SMAGEFILE="$1"; SILENT=1; FVERBOSE=off ;;
57   --help|-h) usage ;;   --help|-h) usage ;;
58   esac   esac
59   shift   shift
60  done  done
61    
62  # sanity checks; abort if not given  # sanity checks; abort if not given
63  [ -z "${PCAT}" ] && usage  if [[ -z ${SMAGEFILE} ]]
64  [ -z "${PNAME}" ] && usage  then
65  [ -z "${PVER}" ] && usage   [ -z "${PCAT}" ] && usage
66  [ -z "${PBUILD}" ] && usage   [ -z "${PNAME}" ] && usage
67     [ -z "${PVER}" ] && usage
68     [ -z "${PBUILD}" ] && usage
69    fi
70  [ -z "${METHOD}" ] && usage  [ -z "${METHOD}" ] && usage
71    
72  # check needed global vars  # check needed global vars
# Line 83  done Line 76  done
76    
77  # other needed vars  # other needed vars
78  ALLDEPS=""  ALLDEPS=""
79    if [[ -n ${SMAGEFILE} ]]
80    then
81     if [[ -e ${SMAGEFILE} ]]
82     then
83     smagesource "${SMAGEFILE}"
84     else
85     die "Smage file '${SMAGEFILE}' does not exist!"
86     fi
87    fi
88  MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage"  MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage"
89    
90  # much faster than fgrep  # much faster than fgrep
# Line 294  then Line 296  then
296   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   ALLDEPS="${ALLDEPS} ${MAGEFILE}"
297   fi   fi
298   else   else
299   # debug info   # debug info
300   decho "ignored package"   decho "ignored package"
301   decho   decho
  fi  
302   fi   fi
303   done   done
304  else  else
  LOOP_COUNTER=0  
305   # get all dependencies of the package   # get all dependencies of the package
306   depwalking ${MAGEFILE}   if [[ -n ${SMAGEFILE} ]]
307     then
308     depwalking "${SMAGEFILE}"
309     else
310     depwalking "${MAGEFILE}"
311     fi
312  fi  fi
313    
314  if [[ ${METHOD} != install-build-prerequisites ]] &&  if [[ ${METHOD} != install-build-prerequisites ]] &&

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