Skip to content

Commit aaca481

Browse files
fix (reproducibility): always enforce tag check regardless of --apk
1 parent 968dfec commit aaca481

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

reproducibility/verify_build.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ if [[ -z "$appVersion" && -z "$apkPath" ]]; then
9292
exit 1
9393
fi
9494

95-
# When verifying a GitHub release, the repo must be at the matching tag so the
96-
# Docker build uses the same source (and thus the same SOURCE_DATE_EPOCH).
97-
# When --apk is provided the caller controls both APKs, so this check is skipped.
98-
if [[ -z "$apkPath" ]]; then
95+
if [[ -n "$appVersion" ]]; then
9996
expectedTag="v${appVersion}"
10097
localTag=$(git -C "$REPO_ROOT" tag --points-at HEAD 2>/dev/null | grep -x "$expectedTag" || true)
10198
if [[ -z "$localTag" ]]; then
@@ -167,6 +164,14 @@ if [[ -z "$appVersion" ]]; then
167164
exit 1
168165
fi
169166
echo "Version (from APK): $appVersion"
167+
expectedTag="v${appVersion}"
168+
localTag=$(git -C "$REPO_ROOT" tag --points-at HEAD 2>/dev/null | grep -x "$expectedTag" || true)
169+
if [[ -z "$localTag" ]]; then
170+
currentRef=$(git -C "$REPO_ROOT" describe --tags --always 2>/dev/null || echo "unknown")
171+
echo -e "${RED}Error: local repo is not at tag $expectedTag (currently at: $currentRef)${NC}"
172+
echo "Run: git checkout $expectedTag"
173+
exit 1
174+
fi
170175
fi
171176

172177
# Setup workspace
@@ -420,7 +425,7 @@ else
420425
echo -e "verdict: ${RED}$verdict${NC}"
421426
echo ""
422427
echo "Differences (excluding META-INF):"
423-
echo "$diff_output" | head -30
428+
{ echo "$diff_output" | head -30; } || true
424429
[[ $(echo "$diff_output" | wc -l) -gt 30 ]] && echo "... (truncated, see $workDir/)"
425430
exitCode=1
426431
fi

0 commit comments

Comments
 (0)