Magellan Linux

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

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

revision 2195 by niro, Thu Oct 10 11:05:34 2013 UTC revision 2274 by niro, Fri Oct 25 07:52:00 2013 UTC
# Line 33  usage() Line 33  usage()
33   echo "  -b     --pbuild        build number of the package"   echo "  -b     --pbuild        build number of the package"
34   echo "  -m     --method        which calc method should be used:"   echo "  -m     --method        which calc method should be used:"
35   echo "                         install, srcinstall, depend, srcdepend"   echo "                         install, srcinstall, depend, srcdepend"
36   echo "                         upgrade, srcupgrade"   echo "                         upgrade, srcupgrade,"
37     echo "                         install-build-prerequisites,"
38     echo "                         pretend-build-prerequisites"
39     echo "  -d     --debug         enable debug mode"
40   echo   echo
41   echo "method, name, version and build must be given !"   echo "method, name, version and build must be given !"
42   echo   echo
43   exit 1   exit 1
44  }  }
45    
46    # always default debug=0
47    DEBUG=0
48    
49  # very basic getops  # very basic getops
50  for i in $*  for i in $*
51  do  do
# Line 49  do Line 55  do
55   --pver|-v) shift; PVER="$1" ;;   --pver|-v) shift; PVER="$1" ;;
56   --pbuild|-b) shift; PBUILD="$1" ;;   --pbuild|-b) shift; PBUILD="$1" ;;
57   --method|-m) shift; METHOD="$1" ;;   --method|-m) shift; METHOD="$1" ;;
58     --debug|-d) shift; DEBUG=1 ;;
59   --help|-h) usage ;;   --help|-h) usage ;;
60   esac   esac
61   shift   shift
# Line 151  depwalking() Line 158  depwalking()
158   fi   fi
159   fi   fi
160    
161     if [[ ${METHOD} = install-build-prerequisites ]] || \
162     [[ ${METHOD} = pretend-build-prerequisites ]]
163     then
164     # only one time
165     if [[ ${LOOP_COUNTER} -lt 1 ]]
166     then
167     # only if SDEPEND is not zero
168     if [ -n "${SDEPEND}" ]
169     then
170     # crlf is substantly needed !!
171     if [ -n "${MY_DEPEND}" ]
172     then
173     MY_DEPEND="${MY_DEPEND}
174     ${SDEPEND}"
175     else
176     MY_DEPEND="${SDEPEND}"
177     fi
178     fi
179     fi
180     LOOP_COUNTER=${LOOP_COUNTER}+1
181     fi
182    
183   unset DEPEND   unset DEPEND
184   unset SDEPEND   unset SDEPEND
185    
# Line 161  depwalking() Line 190  depwalking()
190    
191   while read SYM DEPNAME   while read SYM DEPNAME
192   do   do
193     if [[ ${DEBUG} = 1 ]]
194     then
195     echo "DEBUG: DEPNAME='${DEPNAME}'" >&2
196     fi
197    
198   # exclude empty depnames   # exclude empty depnames
199   [[ -z ${DEPNAME} ]] && continue   [[ -z ${DEPNAME} ]] && continue
200    
# Line 212  EOF Line 246  EOF
246  [[ ${METHOD} = pretend ]] || \  [[ ${METHOD} = pretend ]] || \
247   [[ ${METHOD} = srcpretend ]] || \   [[ ${METHOD} = srcpretend ]] || \
248   [[ ${METHOD} = uppretend ]] || \   [[ ${METHOD} = uppretend ]] || \
249   [[ ${METHOD} = srcuppretend ]] && \   [[ ${METHOD} = srcuppretend ]] || \
250     [[ ${METHOD} = pretend-build-prerequisites ]] && \
251   echo -n "Calculating dependencies ... "   echo -n "Calculating dependencies ... "
252    
253    
# Line 250  then Line 285  then
285   fi   fi
286   done   done
287  else  else
288     LOOP_COUNTER=0
289   # get all dependencies of the package   # get all dependencies of the package
290   depwalking ${MAGEFILE}   depwalking ${MAGEFILE}
291  fi  fi
292    
293  # now add the package itself to the dependencies  if [[ ${METHOD} != install-build-prerequisites ]] &&
294  # (if not exists already)   [[ ${METHOD} != pretend-build-prerequisites ]]
 if checklist_alldeps "${MAGEFILE}"  
295  then  then
296   ALLDEPS="${ALLDEPS} ${MAGEFILE}"   # now add the package itself to the dependencies
297     # (if not exists already)
298     if checklist_alldeps "${MAGEFILE}"
299     then
300     ALLDEPS="${ALLDEPS} ${MAGEFILE}"
301     fi
302  fi  fi
303    
304  [[ ${METHOD} = pretend ]] || \  [[ ${METHOD} = pretend ]] || \
305   [[ ${METHOD} = srcpretend ]] || \   [[ ${METHOD} = srcpretend ]] || \
306   [[ ${METHOD} = uppretend ]] || \   [[ ${METHOD} = uppretend ]] || \
307   [[ ${METHOD} = srcuppretend ]] && \   [[ ${METHOD} = srcuppretend ]] || \
308     [[ ${METHOD} = pretend-build-prerequisites ]] && \
309   echo "done"   echo "done"
310    
311    
# Line 272  fi Line 313  fi
313  if [[ ${METHOD} = pretend ]] || \  if [[ ${METHOD} = pretend ]] || \
314   [[ ${METHOD} = srcpretend ]] || \   [[ ${METHOD} = srcpretend ]] || \
315   [[ ${METHOD} = uppretend ]] || \   [[ ${METHOD} = uppretend ]] || \
316   [[ ${METHOD} = srcuppretend ]]   [[ ${METHOD} = srcuppretend ]] || \
317     [[ ${METHOD} = pretend-build-prerequisites ]]
318  then  then
319   # this is a little bit faster   # this is a little bit faster
320   declare -i x=0   declare -i x=0
# Line 289  then Line 331  then
331   PBUILD="$(magename2pbuild ${i})"   PBUILD="$(magename2pbuild ${i})"
332   if [ -z "${list}" ]   if [ -z "${list}" ]
333   then   then
334   list="\t${COLBLUE}[${k}] ${COLGREEN}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"   list="\t${COLBLUE}[${k}] ${COLGREEN}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
335   else   else
336   list="${list}   list="${list}
337  \t${COLBLUE}[${k}] ${COLGREEN}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"  \t${COLBLUE}[${k}] ${COLGREEN}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
# Line 331  fi Line 373  fi
373  [[ ${METHOD} = install ]] || \  [[ ${METHOD} = install ]] || \
374   [[ ${METHOD} = srcinstall ]] || \   [[ ${METHOD} = srcinstall ]] || \
375   [[ ${METHOD} = upgrade ]] || \   [[ ${METHOD} = upgrade ]] || \
376   [[ ${METHOD} = srcupgrade ]] && \   [[ ${METHOD} = srcupgrade ]] || \
377     [[ ${METHOD} = install-build-prerequisites ]] && \
378   echo "${ALLDEPS}"   echo "${ALLDEPS}"

Legend:
Removed from v.2195  
changed lines
  Added in v.2274