@@ 1,23 1,74 @@
#!/bin/sh
-# Needs: fd, bash
+# Needs: fd, bash, abuild, dateutils
-function build() {
- pkg="$1"
- echo Building $pkg
+# Build a specific package
+# Arg 1: the repo path (e.g. broken, main or testing)
+# Arg 2: the package name (e.g. oomph)
+function build_package() {
+ start="$( date | awk -F ' ' '{ print $4 }' )"
+ repo="$1"
+ pkg="$2"
+ echo ">>> Building $pkg from $repo"
- cd $pkg
+ cd $repo/$pkg
abuild -r
- cd ..
+ cd ../..
+ end="$( date | awk -F ' ' '{ print $4 }' )"
+ echo ">>> $pkg took $(datediff $start $end)"
+ echo
}
-if [ "$1" = "all" ]; then
- echo Building all
- fd --type d | \
+# Build all packages from a repo
+# Arg 1: the repo patch (e.g. broken, main or testing)
+function build_subrepo() {
+ start="$( date | awk -F ' ' '{ print $4 }' )"
+ repo="$1"
+ echo ">> Building $repo subrepo"
+
+ cd $repo
+
+ fd --type d --exact-depth 1 | \
while read pkg; do
- build $pkg
+ pkg="$(echo $pkg | sed 's/.\///' | sed 's/\///')"
+ cd ..
+ build_package $repo $pkg
+ cd $repo
+ done
+
+ cd ..
+ end="$( date | awk -F ' ' '{ print $4 }' )"
+ echo ">> Finished $repo, took $(datediff $start $end)"
+ echo
+}
+
+# Builds all packages
+# from all repos
+# EXCEPT the broken repo,
+# as that repo contains broken APKBUILDS
+function build_all() {
+ start="$( date | awk -F ' ' '{ print $4 }' )"
+ echo "> TASK: Building all repositories"
+ echo
+
+ fd --type d --exact-depth 1 | \
+ while read repo; do
+ repo="$(echo $repo | sed 's/.\///' | sed 's/\///')"
+ if [ "$repo" != "broken" ]; then
+ build_subrepo $repo
+ fi
done
+
+ end="$( date | awk -F ' ' '{ print $4 }' )"
+ echo Finished all, took $(datediff $start $end)
+}
+
+if [ "$1" = "all" ]; then
+ build_all
+elif [ "$1" = "repo" ]; then
+ echo Building repo $2
+ build_subrepo "$2"
else
- echo Building "$1"
- build $1
+ echo Building $2 from $1
+ build_package "$1" "$2"
fi