CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Added initial version of some scripts
authorJose V Beneyto <sepen@crux.nu>
Wed, 20 Oct 2010 10:40:32 +0000 (12:40 +0200)
committerJose V Beneyto <sepen@crux.nu>
Wed, 20 Oct 2010 10:40:32 +0000 (12:40 +0200)
buildAllPackages.sh [new file with mode: 0755]
getBuildOrder.sh [new file with mode: 0755]

diff --git a/buildAllPackages.sh b/buildAllPackages.sh
new file mode 100755 (executable)
index 0000000..501b473
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+[ ! -f getBuildOrder.sh ] && exit 1
+
+for port in $(sh getBuildOrder.sh); do
+  [ ! -f "${port}/Pkgfile" ] && exit 1
+  . $port/Pkgfile
+  [ -f "$port/${name}#${version}-${release}.pkg.tar.gz" ] && continue
+  cd $port || exit 1
+  ( fakeroot pkgmk-cross -d 2>&1 | tee pkgmk.log ) || exit 1
+  ( sudo pkgadd-cross $(find . -type f -name '*.pkg.tar.gz') || sudo pkgadd-cross -f $(find . -type f -name '*.pkg.tar.gz') ) || exit 1
+  cd - || exit 1
+done 
+
+# End fo file
diff --git a/getBuildOrder.sh b/getBuildOrder.sh
new file mode 100755 (executable)
index 0000000..cca2c9e
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+getDeps() {
+  local pkg="$1"
+  local deps="$(grep "^# Depends on:" $pkg/Pkgfile | cut -d':' -f2-)"
+  echo "${deps# *}"
+}
+
+getRecursiveDeps() {
+  local pkg="$1"
+  local deps="$(getDeps $pkg)"
+  if [ -z "$deps" ]; then
+    case $pkg in
+      libgmp|libmpfr|binutils|glibc|gcc)
+        # discard these ports
+        ;;
+      *)
+        if [ ! "$(echo $BUILD_ORDER | grep " ${pkg}")" ]; then
+          BUILD_ORDER="$BUILD_ORDER $pkg"
+        fi
+       ;;
+    esac
+  else
+    for d in ${deps[@]}; do
+      getRecursiveDeps "$d"
+    done
+    BUILD_ORDER="$BUILD_ORDER $pkg"
+  fi
+}
+
+# global var to store all final deps order
+BUILD_ORDER="libgmp libmpfr binutils glibc gcc"
+
+for f in *; do
+  [ ! -d "$f" ] && continue
+  case $f in
+    libgmp|libmpfr|binutils|glibc|gcc) continue ;;
+  esac
+  getRecursiveDeps "$f"
+done
+
+echo $BUILD_ORDER
+echo
+
+# End fo file