-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-package.sh
executable file
·50 lines (42 loc) · 1.12 KB
/
build-package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env osh
# lets start by building *all that's possible!
#set -e
if [[ -n "$1" ]]; then
recursive=$1
fi
package="$2"
if [[ -n "$package" ]]; then
# We want to use it's pkgname and subpackages to track deps
source main/$package/APKBUILD
# TODO: instead of waiting, the cleanup task should also start all new pkg builds
# while [ -z "$(ls -A "deps/$pkgname")" ]; do
# sleep 1
# done
cd main/$package
echo "build $package. logs: /aports/${recursive}_build.log" | tee "/aports/${recursive}_build.log"
abuild -rq -P /aports/repo &> /aports/${recursive}_build.log
rc=$?
cd -
if [[ "$rc" = 0 ]]; then
find deps -name $pkgname -delete
for sub in $subpackages; do
sub="${sub%%:*}"
find deps -name $sub -delete
done
else
mkdir -p /aports/logs
mv /aports/${recursive}_build.log /aports/logs/$package.log
fi
fi
if [[ -n "$recursive" ]]; then
f=$(mktemp -u)
for pkg in $(find deps/ -empty -type d); do
mv "$pkg" $f || true
if ! [[ -d "$f" ]]; then
continue
fi
rmdir "$f"
./build-package.sh "$recursive" "$(basename $pkg)"
exit
done
fi