diff --git a/.forgejo/patches/build.patch b/.forgejo/patches/build.patch index 463ddf4..6c976a7 100644 --- a/.forgejo/patches/build.patch +++ b/.forgejo/patches/build.patch @@ -1,7 +1,7 @@ diff --git a/usr/local/bin/build.sh.orig b/usr/local/bin/build.sh old mode 100644 new mode 100755 -index c3b8f7a..d799817 +index c3b8f7a..b3c222e --- a/usr/local/bin/build.sh.orig +++ b/usr/local/bin/build.sh @@ -7,13 +7,14 @@ @@ -9,7 +9,7 @@ index c3b8f7a..d799817 readonly APORTSDIR=$CI_PROJECT_DIR -readonly REPOS="main community testing non-free" -+readonly ALPINE_REPOS="main community testing" ++readonly REPOS="main community testing" readonly ARCH=$(apk --print-arch) # gitlab variables readonly BASEBRANCH=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME @@ -21,7 +21,7 @@ index c3b8f7a..d799817 : "${MAX_ARTIFACT_SIZE:=300000000}" #300M : "${CI_DEBUG_BUILD:=}" -@@ -67,13 +68,24 @@ report() { +@@ -67,10 +68,14 @@ report() { } get_release() { @@ -39,19 +39,12 @@ index c3b8f7a..d799817 esac } -+readonly REPOS="qubes-$(get_qubes_release)" -+ -+# hack to support at-root packages -+changed_repos() { -+ echo "." -+} -+ - build_aport() { - local repo="$1" aport="$2" - cd "$APORTSDIR/$repo/$aport" -@@ -101,11 +113,11 @@ set_repositories_for() { +@@ -99,13 +104,13 @@ set_repositories_for() { + local release + release=$(get_release) - for repo in $REPOS; do +- for repo in $REPOS; do ++ for repo in qubes-$(get_qubes_release); do [ "$repo" = "non-free" ] && continue - [ "$release" != "edge" ] && [ "$repo" == "testing" ] && continue + [ "$release" == "edge" ] && [ "$repo" == "backports" ] && continue @@ -63,7 +56,7 @@ index c3b8f7a..d799817 doas apk update } -@@ -118,7 +130,15 @@ apply_offset_limit() { +@@ -118,7 +123,15 @@ apply_offset_limit() { } setup_system() { @@ -72,7 +65,7 @@ index c3b8f7a..d799817 + local release + + release=$(get_release) -+ for repo in $ALPINE_REPOS; do ++ for repo in $REPOS; do + [ "$release" != "edge" ] && [ "$repo" == "testing" ] && continue + repos="$repos $ALPINE_MIRROR/$release/$repo" + done @@ -80,3 +73,50 @@ index c3b8f7a..d799817 doas apk -U upgrade -a || apk fix || die "Failed to up/downgrade system" abuild-keygen -ain doas sed -i -E 's/export JOBS=[0-9]+$/export JOBS=$(nproc)/' /etc/abuild.conf +@@ -192,32 +205,22 @@ section_end setup + build_start=$CI_ALPINE_BUILD_OFFSET + build_limit=$CI_ALPINE_BUILD_LIMIT + +-for repo in $(changed_repos); do +- set_repositories_for "$repo" +- built_aports=0 +- changed_aports_in_repo=$(changed_aports "$repo") +- changed_aports_in_repo_count=$(echo "$changed_aports_in_repo" | wc -l) +- changed_aports_to_build=$(echo "$changed_aports_in_repo" | apply_offset_limit "$build_start" "$build_limit") ++set_repositories_for $(get_qubes_release) ++built_aports=0 ++changed_aports_in_repo=$(changed_aports $BASEBRANCH) ++changed_aports_in_repo_count=$(echo "$changed_aports_in_repo" | wc -l) ++changed_aports_to_build=$(echo "$changed_aports_in_repo" | apply_offset_limit "$build_start" "$build_limit") + +- msg "Changed aports in $repo:" +- # shellcheck disable=SC2086 # Splitting is expected here +- printf " - %s\n" $changed_aports_to_build +- for pkgname in $changed_aports_to_build; do +- section_start "build_$pkgname" "Building package $pkgname" +- built_aports=$((built_aports+1)) +- if check_aport "$repo" "$pkgname"; then +- build_aport "$repo" "$pkgname" +- fi +- section_end "build_$pkgname" +- done +- +- build_start=$((build_start-(changed_aports_in_repo_count-built_aports))) +- build_limit=$((build_limit-built_aports)) +- +- if [ $build_limit -le 0 ]; then +- msg "Limit reached, breaking" +- break ++msg "Changed aports:" ++# shellcheck disable=SC2086 # Splitting is expected here ++printf " - %s\n" $changed_aports_to_build ++for pkgname in $changed_aports_to_build; do ++ section_start "build_$pkgname" "Building package $pkgname" ++ built_aports=$((built_aports+1)) ++ if check_aport qubes-aports "$pkgname"; then ++ build_aport qubes-aports "$pkgname" + fi ++ section_end "build_$pkgname" + done + + section_start artifacts "Handeling artifacts" collapse