From ae841da3852b0b027082ee1fbb45ea2fab453ab4 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Thu, 18 Oct 2012 21:32:55 +0000 Subject: [PATCH] Fixed some issues with getBuildOrder script (duplicates, nonexistent ports, ...) --- getBuildOrder.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/getBuildOrder.sh b/getBuildOrder.sh index 86af3fd..89ca093 100755 --- a/getBuildOrder.sh +++ b/getBuildOrder.sh @@ -2,7 +2,7 @@ getDeps() { local pkg="$1" - local deps="$(grep "^# Depends on:" $pkg/Pkgfile | cut -d':' -f2-)" + local deps="$(grep "^# Depends on:" $pkg/Pkgfile 2>/dev/null| cut -d':' -f2-)" echo "${deps# *}" } @@ -11,8 +11,8 @@ getRecursiveDeps() { local deps="$(getDeps $pkg)" if [ -z "$deps" ]; then case $pkg in + # toolchain ports must be in order libgmp|libmpfr|libmpc|binutils|glibc|zlib|gcc) - # discard these ports ;; *) if [ ! "$(echo $BUILD_ORDER | grep " ${pkg}")" ]; then @@ -24,22 +24,26 @@ getRecursiveDeps() { for d in ${deps[@]}; do getRecursiveDeps "$d" done - BUILD_ORDER="$BUILD_ORDER $pkg" + + if [ ! "$(echo $BUILD_ORDER | grep " ${pkg}")" ]; then + BUILD_ORDER="$BUILD_ORDER $pkg" + fi fi } # global var to store all final deps order BUILD_ORDER="libgmp libmpfr libmpc binutils glibc zlib gcc" -for f in *; do - [ ! -d "$f" ] && continue - case $f in +for i in $(find . -type f -name 'Pkgfile' -exec dirname {} \;); do + PKG="$(basename $i)" + case $PKG in + # toolchain ports must be in order libgmp|libmpfr|libmpc|binutils|glibc|zlib|gcc) continue ;; esac - getRecursiveDeps "$f" + getRecursiveDeps "$PKG" done -echo $BUILD_ORDER +echo $BUILD_ORDER | tr ' ' '\n' echo # End fo file -- 2.45.2