From: Jose V Beneyto <sepen@crux.nu>
Date: Thu, 18 Oct 2012 22:24:10 +0000 (+0000)
Subject: Added code to getBuildOrder to use a name of port as starting point (to avoid the... 
X-Git-Url: http://gitweb/?a=commitdiff_plain;h=6adbbcf41f3746a872436f33eeda6f930be50c6f;p=devtools.git

Added code to getBuildOrder to use a name of port as starting point (to avoid the complete list of ports)
---

diff --git a/getBuildOrder.sh b/getBuildOrder.sh
index 89ca093..8488dca 100755
--- a/getBuildOrder.sh
+++ b/getBuildOrder.sh
@@ -31,10 +31,20 @@ getRecursiveDeps() {
   fi
 }
 
-# global var to store all final deps order
-BUILD_ORDER="libgmp libmpfr libmpc binutils glibc zlib gcc"
+ALT_START=0
 
-for i in $(find . -type f -name 'Pkgfile' -exec dirname {} \;); do
+# check for passed arguments
+if [ $# -ne 0 ]; then
+  # use package as starting point
+  ALT_START=1
+  START_PKG=$1
+  BUILD_ORDER=""
+else
+  # global var to store all final deps order
+  BUILD_ORDER="libgmp libmpfr libmpc binutils glibc zlib gcc"
+fi
+
+for i in $(find . -type f -name 'Pkgfile' -exec dirname {} \; | sort); do
   PKG="$(basename $i)"
   case $PKG in
     # toolchain ports must be in order
@@ -43,7 +53,11 @@ for i in $(find . -type f -name 'Pkgfile' -exec dirname {} \;); do
   getRecursiveDeps "$PKG"
 done
 
-echo $BUILD_ORDER | tr ' ' '\n'
+if [ $ALT_START -eq 0 ]; then
+  echo $BUILD_ORDER | tr ' ' '\n'
+else
+  echo $BUILD_ORDER | sed "s|.* $START_PKG|$START_PKG|" | tr ' ' '\n'
+fi
 echo
 
 # End fo file