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 <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-01-24 11:18:56 +01:00
parent 077f72f529
commit 78c616ca27
5 changed files with 8 additions and 36 deletions

6
mk.sh
View File

@ -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 ---"

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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"