Skip to content

Commit 30e57ab

Browse files
authored
fix: fdroid build (#1139)
* fix: fdroid build reproducibility * chore * new: check android build * fix
1 parent f52eac6 commit 30e57ab

3 files changed

Lines changed: 82 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ jobs:
3030
- uses: actions/setup-java@v4
3131
with:
3232
distribution: "zulu"
33-
java-version: "17"
33+
java-version: "21"
3434
- name: Fetch secrets
3535
run: |
3636
curl -u ${{ secrets.BASIC_AUTH }} -o android/app/app.key ${{ secrets.URL_PREFIX }}app.key
3737
curl -u ${{ secrets.BASIC_AUTH }} -o android/key.properties ${{ secrets.URL_PREFIX }}key.properties
3838
- name: Build
39+
env:
40+
LDFLAGS: -Wl,--build-id=none
3941
run: dart run fl_build -p android
42+
- name: Verify F-Droid native libraries
43+
run: scripts/release/verify-fdroid-native-libs.sh
4044
- name: Rename for fdroid
4145
shell: bash
4246
run: |

pubspec.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,10 @@ packages:
918918
dependency: transitive
919919
description:
920920
name: matcher
921-
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
921+
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
922922
url: "https://pub.dev"
923923
source: hosted
924-
version: "0.12.18"
924+
version: "0.12.19"
925925
material_color_utilities:
926926
dependency: transitive
927927
description:
@@ -1506,26 +1506,26 @@ packages:
15061506
dependency: "direct dev"
15071507
description:
15081508
name: test
1509-
sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a"
1509+
sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7"
15101510
url: "https://pub.dev"
15111511
source: hosted
1512-
version: "1.29.0"
1512+
version: "1.30.0"
15131513
test_api:
15141514
dependency: transitive
15151515
description:
15161516
name: test_api
1517-
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
1517+
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
15181518
url: "https://pub.dev"
15191519
source: hosted
1520-
version: "0.7.9"
1520+
version: "0.7.10"
15211521
test_core:
15221522
dependency: transitive
15231523
description:
15241524
name: test_core
1525-
sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943"
1525+
sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51"
15261526
url: "https://pub.dev"
15271527
source: hosted
1528-
version: "0.6.15"
1528+
version: "0.6.16"
15291529
tuple:
15301530
dependency: transitive
15311531
description:
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
6+
APK_DIR="${APK_DIR:-$REPO_ROOT/build/app/outputs/flutter-apk}"
7+
APP_NAME="${APP_NAME:-ServerBox}"
8+
9+
require_cmd() {
10+
local name="$1"
11+
if ! command -v "$name" >/dev/null 2>&1; then
12+
echo "command not found: $name" >&2
13+
exit 1
14+
fi
15+
}
16+
17+
require_cmd find
18+
require_cmd readelf
19+
require_cmd unzip
20+
21+
shopt -s nullglob
22+
23+
tmp_dir="$(mktemp -d)"
24+
trap 'rm -rf "$tmp_dir"' EXIT
25+
26+
failures=()
27+
apks=()
28+
patterns=(
29+
"${APP_NAME}_*_arm64.apk"
30+
"${APP_NAME}_*_arm.apk"
31+
"${APP_NAME}_*_amd64.apk"
32+
)
33+
34+
for pattern in "${patterns[@]}"; do
35+
matches=("$APK_DIR"/$pattern)
36+
if [[ ${#matches[@]} -ne 1 ]]; then
37+
echo "expected exactly 1 APK for pattern: $pattern" >&2
38+
echo "found ${#matches[@]} matches" >&2
39+
echo "APK_DIR: $APK_DIR" >&2
40+
if [[ ${#matches[@]} -gt 0 ]]; then
41+
printf ' %s\n' "${matches[@]}" >&2
42+
else
43+
ls -la "$APK_DIR" || true
44+
fi
45+
exit 1
46+
fi
47+
apks+=("${matches[0]}")
48+
done
49+
50+
for apk in "${apks[@]}"; do
51+
apk_name="$(basename "$apk")"
52+
extract_dir="$tmp_dir/$apk_name"
53+
mkdir -p "$extract_dir"
54+
unzip -qq "$apk" "lib/*/*.so" -d "$extract_dir"
55+
56+
while IFS= read -r so_file; do
57+
if readelf -n "$so_file" | grep -q 'Build ID'; then
58+
failures+=("$apk_name:${so_file#$extract_dir/}")
59+
fi
60+
done < <(find "$extract_dir" -type f -name '*.so' | sort)
61+
done
62+
63+
if [[ ${#failures[@]} -ne 0 ]]; then
64+
echo 'native libraries still contain ELF build-id notes:' >&2
65+
printf ' %s\n' "${failures[@]}" >&2
66+
exit 1
67+
fi
68+
69+
echo 'F-Droid native library verification passed.'

0 commit comments

Comments
 (0)