Skip to content

Commit 213f4d9

Browse files
committed
fix(repro): reorder postbuild steps to match F-Droid
Order must be: remove files -> fix-pg-map-id (with zipalign) -> sign Previous order broke zipalign by running file removal after fix-pg-map-id — opus-4.5
1 parent e70a591 commit 213f4d9

2 files changed

Lines changed: 14 additions & 37 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -122,54 +122,31 @@ jobs:
122122
- name: Build unsigned release APK
123123
run: ./gradlew clean assembleRelease --stacktrace --no-build-cache
124124

125-
# REPRODUCIBILITY: Fix non-deterministic R8 pg-map-id in DEX files
126-
# This ensures byte-identical APKs between GitHub and F-Droid builds
127-
# Using fixed pg-map-id "0000000" - must match F-Droid postbuild
128-
# Using --internal for Python-based alignment (build-tools 34.0.0 lacks -P flag)
129-
- name: Fix pg-map-id for reproducibility
125+
# REPRODUCIBILITY STEP 1: Remove non-deterministic META-INF files
126+
# ORDER MATTERS: This must run BEFORE fix-pg-map-id to match F-Droid postbuild order
127+
# Uses Python zipfile (no zip command in F-Droid build env)
128+
- name: Remove non-deterministic metadata
130129
run: |
131130
cd build/outputs/apk/release
132131
for apk in *.apk; do
133-
echo "Fixing pg-map-id in $apk..."
134-
python3 ${{ github.workspace }}/reproducible-apk-tools/inplace-fix.py \
135-
--page-size 16 --internal fix-pg-map-id "$apk" 0000000
132+
echo "Removing metadata from $apk..."
133+
python3 -c "import zipfile,sys,tempfile,shutil;a=sys.argv[1];t=tempfile.mktemp('.apk');z=zipfile.ZipFile(a);o=zipfile.ZipFile(t,'w');[o.writestr(i,z.read(i.filename))for i in z.infolist()if not(i.filename.startswith('META-INF/com/')or i.filename.startswith('META-INF/services/'))];z.close();o.close();shutil.move(t,a)" "$apk"
136134
done
137-
echo "APKs after pg-map-id fix:"
138-
ls -la *.apk
139135
140-
# REPRODUCIBILITY: Fix META-INF/services newline variations
141-
# Must match F-Droid postbuild step
142-
- name: Fix newlines for reproducibility
136+
# REPRODUCIBILITY STEP 2: Fix pg-map-id and zipalign
137+
# ORDER MATTERS: This must run AFTER removing files, as it also does zipalign
138+
# Using fixed pg-map-id "0000000" - must match F-Droid postbuild
139+
- name: Fix pg-map-id for reproducibility
143140
run: |
144141
cd build/outputs/apk/release
145142
for apk in *.apk; do
146-
echo "Fixing newlines in $apk..."
143+
echo "Fixing pg-map-id in $apk..."
147144
python3 ${{ github.workspace }}/reproducible-apk-tools/inplace-fix.py \
148-
--page-size 16 --internal fix-newlines "$apk" 'META-INF/services/*'
145+
--page-size 16 --internal fix-pg-map-id "$apk" 0000000
149146
done
150-
echo "APKs after newlines fix:"
147+
echo "APKs after reproducibility fixes:"
151148
ls -la *.apk
152149
153-
# REPRODUCIBILITY: Strip any residual signatures before re-signing
154-
# Ensures clean signature without interference from build-time debug signing
155-
- name: Strip old signatures
156-
run: |
157-
cd build/outputs/apk/release
158-
for apk in *.apk; do
159-
echo "Stripping signatures from $apk..."
160-
zip -d "$apk" 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*.DSA' 'META-INF/*.EC' 'META-INF/CERT*' 'META-INF/MANIFEST.MF' 2>/dev/null || true
161-
done
162-
163-
# REPRODUCIBILITY: Delete non-deterministic files that excludes didn't catch
164-
# Uses Python zipfile to match F-Droid postbuild (which doesn't have zip command)
165-
- name: Remove non-deterministic metadata
166-
run: |
167-
cd build/outputs/apk/release
168-
for apk in *.apk; do
169-
echo "Removing metadata from $apk..."
170-
python3 -c "import zipfile,sys,tempfile,shutil;a=sys.argv[1];t=tempfile.mktemp('.apk');z=zipfile.ZipFile(a);o=zipfile.ZipFile(t,'w');[o.writestr(i,z.read(i.filename))for i in z.infolist()if not(i.filename.startswith('META-INF/com/')or i.filename.startswith('META-INF/services/'))];z.close();o.close();shutil.move(t,a)" "$apk"
171-
done
172-
173150
# Sign the APKs with our release key after fixes
174151
# inplace-fix.py already did zipalign with -P 16
175152
- name: Sign release APKs

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies {
5050
// UPDATE ONLY THESE THREE VALUES FOR A NEW RELEASE:
5151
ext.VERSION_MAJOR = 1
5252
ext.VERSION_MINOR = 1
53-
ext.VERSION_PATCH = 60
53+
ext.VERSION_PATCH = 61
5454
// =============================================================================
5555
// DERIVED VALUES (auto-calculated, do not edit):
5656
// - versionCode = MAJOR*10000 + MINOR*100 + PATCH

0 commit comments

Comments
 (0)