add custom changed_aports
Some checks failed
/ lint (pull_request) Successful in 25s
/ build-edge (pull_request) Successful in 30s
/ deploy-edge (pull_request) Failing after 1m38s

This commit is contained in:
Antoine Martin 2024-08-16 00:47:53 -04:00
parent d3ae459fa7
commit 45ad40dc49
Signed by: forge
GPG key ID: D62A472A4AA7D541

View file

@ -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..1bc2dc2
index c3b8f7a..9df8db4
--- a/usr/local/bin/build.sh.orig
+++ b/usr/local/bin/build.sh
@@ -7,13 +7,14 @@
@ -21,7 +21,7 @@ index c3b8f7a..1bc2dc2
: "${MAX_ARTIFACT_SIZE:=300000000}" #300M
: "${CI_DEBUG_BUILD:=}"
@@ -67,13 +68,22 @@ report() {
@@ -67,13 +68,32 @@ report() {
}
get_release() {
@ -39,15 +39,25 @@ index c3b8f7a..1bc2dc2
esac
}
+# hack to have vanilla changed-aports work
+changed_repos() {
+ echo "."
+changed_aports() {
+ : "${APORTSDIR?APORTSDIR missing}"
+ : "${BASEBRANCH?BASEBRANCH missing}"
+
+ cd "$APORTSDIR"
+ local aports
+
+ aports=$(git diff --name-only --diff-filter=ACMR \
+ "$BASEBRANCH"...HEAD -- "*/APKBUILD" | xargs -rn1 dirname)
+
+ # shellcheck disable=2086
+ ap builddirs -d "$APORTSDIR" $aports 2>/dev/null | xargs -rn1 basename
+}
+
+
build_aport() {
local repo="$1" aport="$2"
cd "$APORTSDIR/$repo/$aport"
@@ -99,13 +109,13 @@ set_repositories_for() {
@@ -99,13 +119,13 @@ set_repositories_for() {
local release
release=$(get_release)
@ -64,7 +74,7 @@ index c3b8f7a..1bc2dc2
doas apk update
}
@@ -118,7 +128,15 @@ apply_offset_limit() {
@@ -118,7 +138,15 @@ apply_offset_limit() {
}
setup_system() {
@ -81,7 +91,7 @@ index c3b8f7a..1bc2dc2
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 +210,22 @@ section_end setup
@@ -192,32 +220,22 @@ section_end setup
build_start=$CI_ALPINE_BUILD_OFFSET
build_limit=$CI_ALPINE_BUILD_LIMIT
@ -93,7 +103,7 @@ index c3b8f7a..1bc2dc2
- 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 $repo)
+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")