From 78c616ca273c67aef2c4fadc0f55734a28172a13 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 24 Jan 2018 11:18:56 +0100 Subject: [PATCH] Simplify dependency handling - dependencies() accepts a single package name instead of a list. Is used only that way anwayway. - Remove most temporary packge lists Signed-off-by: David Oberhollenzer --- mk.sh | 6 ++---- pkg/rootfs-alix/build | 5 +---- pkg/rootfs-rpi3/build | 5 +---- util/depends.sh | 25 +++---------------------- util/toolchain.sh | 3 +-- 5 files changed, 8 insertions(+), 36 deletions(-) diff --git a/mk.sh b/mk.sh index d27041a..6ee2814 100755 --- a/mk.sh +++ b/mk.sh @@ -44,8 +44,7 @@ source "$SCRIPTDIR/util/cmake.sh" ############################## build toolchain ############################### echo "--- resolving toolchain dependencies ---" -echo "toolchain" > "$BUILDROOT/$CFG/rawpkg" -dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "tcpkg" +dependencies "toolchain" "tcpkg" > "$PACKAGELIST" cat "$PACKAGELIST" echo "--- downloading toolchain files ---" @@ -70,8 +69,7 @@ save_toolchain ############################### build packages ############################### echo "--- resolving package dependencies ---" -echo "release-${CFG}" > "$BUILDROOT/$CFG/rawpkg" -dependencies "$BUILDROOT/$CFG/rawpkg" "$PACKAGELIST" "pkg" +dependencies "release-${CFG}" "pkg" > "$PACKAGELIST" cat "$PACKAGELIST" echo "--- downloading package files ---" diff --git a/pkg/rootfs-alix/build b/pkg/rootfs-alix/build index 4f16f4e..4216371 100755 --- a/pkg/rootfs-alix/build +++ b/pkg/rootfs-alix/build @@ -11,11 +11,8 @@ build() { echo "/lib" > "$BUILD/etc/ld-musl-i386.path" # install packages to rootfs - cat "$SCRIPTDIR/pkg/rootfs-alix/depends" | sort -u > "$BUILD/rawpkg" - - dependencies "$BUILD/rawpkg" "$BUILD/etc/packages" "pkg" + dependencies "rootfs-alix" "pkg" | grep -v "rootfs-alix" > "$BUILD/etc/packages" echo "toolchain" >> "$BUILD/etc/packages" - rm -f "$BUILD/rawpkg" while read pkgname; do if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then diff --git a/pkg/rootfs-rpi3/build b/pkg/rootfs-rpi3/build index b929918..95ca938 100755 --- a/pkg/rootfs-rpi3/build +++ b/pkg/rootfs-rpi3/build @@ -12,11 +12,8 @@ build() { echo "/opt/vc/lib" >> "$BUILD/etc/ld-musl-arm.path" # install packages to rootfs - cat "$SCRIPTDIR/pkg/rootfs-rpi3/depends" | sort -u > "$BUILD/rawpkg" - - dependencies "$BUILD/rawpkg" "$BUILD/etc/packages" "pkg" + dependencies "rootfs-rpi3" "pkg" | grep -v "rootfs-rpi3" > "$BUILD/etc/packages" echo "toolchain" >> "$BUILD/etc/packages" - rm -f "$BUILD/rawpkg" while read pkgname; do if [ ! -e "$PKGDEPLOYDIR/$pkgname" ]; then diff --git a/util/depends.sh b/util/depends.sh index a6d8070..c4848df 100755 --- a/util/depends.sh +++ b/util/depends.sh @@ -14,27 +14,8 @@ dependencies_recursive() { } dependencies() { - local RAW="$1" - local PKGLIST="$2" - local PKGDIR="$3" - local TEMP=$(mktemp) + local NAME="$1" + local PKGDIR="$2" - truncate -s 0 "$PKGLIST" - - # handle toplevel packages _with_ depenendencies - while read pkgname; do - dependencies_recursive "$pkgname" "$PKGDIR" >> "$TEMP" - done < "$RAW" - - # handle toplevel packages without dependencies - while read pkgname; do - if [ ! -e "$SCRIPTDIR/$PKGDIR/$pkgname/depends" ]; then - grep -q "$pkgname" "$TEMP" &> /dev/null || \ - echo "$pkgname" >> "$PKGLIST" - fi - done < "$RAW" - - # generate topologically sorted list of packages - sort -u "$TEMP" | tsort | tac >> "$PKGLIST" - rm "$TEMP" + dependencies_recursive "$NAME" "$PKGDIR" | tsort | tac } diff --git a/util/toolchain.sh b/util/toolchain.sh index aa3c008..8000ce8 100644 --- a/util/toolchain.sh +++ b/util/toolchain.sh @@ -20,8 +20,7 @@ install_build_deps() { return fi - dependencies "$SCRIPTDIR/pkg/$pkg/depends" \ - "$BUILDROOT/$CFG/deppkg" "pkg" + dependencies "$pkg" "pkg" | grep -v "$pkg" > "$BUILDROOT/$CFG/deppkg" while read deppkg; do local devdir="$PKGDEPLOYDIR/${deppkg}-dev"