#!/usr/bin/env zsh set -eax # TODO: once builder has IPv4, consider replacing most usage with lua-aports' buildrepo (https://gitlab.alpinelinux.org/alpine/lua-aports/-/blob/master/buildrepo.1.scd) # Example of usage: # $ buildrepo -a "$PWD/src" -d "$PWD/target" -R memdmp util utau # -> This also allows cross-arch building assuming https://wiki.alpinelinux.org/wiki/How_to_make_a_cross_architecture_chroot is setup via e.g. CBUILD=aarch64 # note: we assume `abuild-keygen -a -i` has alr been run ALL_TARGET="$PWD/target" export APORTSDIR="$PWD/src" for REPOPATH in ./src/*; do cd "$REPOPATH"; REPO="$(basename "$REPOPATH")"; for PKG in ./*; do if [[ -d "$PKG" ]] && [[ -f "$PKG/APKBUILD" ]]; then cd "$PKG"; PKG="$(basename "$PKG")"; if [[ "$FILTER" == "" ]] || [[ "$FILTER" == "$REPO" ]] || [[ "$FILTER" == "$PKG" ]] || [[ "$FILTER" == "$REPO/$PKG" ]]; then if [[ "$IPV6_ONLY" == "true" ]] && [[ -f ".is_ipv4_only" ]]; then echo -e "Skipping repository." else if [[ "$NEWSUM" == "1" ]]; then abuild checksum; fi if [[ "$ROOTBLD" != "0" ]]; then abuild -P "$ALL_TARGET" rootbld else abuild -r -P "$ALL_TARGET" fi fi fi cd ..; fi done cd ../..; done