From 258775a10e88915ab78d2bc7e8265f2b292cb9b0 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Wed, 20 Oct 2010 12:40:32 +0200 Subject: [PATCH] Added initial version of some scripts --- buildAllPackages.sh | 15 +++++++++++++++ getBuildOrder.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 buildAllPackages.sh create mode 100755 getBuildOrder.sh diff --git a/buildAllPackages.sh b/buildAllPackages.sh new file mode 100755 index 0000000..501b473 --- /dev/null +++ b/buildAllPackages.sh @@ -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 index 0000000..cca2c9e --- /dev/null +++ b/getBuildOrder.sh @@ -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 -- 2.26.2