-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reproducible builds #2390
reproducible builds #2390
Conversation
f21b241
to
a6032c3
Compare
a6032c3
to
7f95790
Compare
It "works for me" 😅 and I don't see how these modifications would impact anyone who doesn't want reproducible builds, so I think this can be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice idea and approach.
Thanks for taking time investigating this and documenting code and outcome.
Would you mind rebasing/squashing?
I've made some tiny comments, but nothing blocking
* pass SOURCE_DATE_EPOCH etc. through to build env * clean tar entries & gzip mtime * utime() files before zipping * sort file lists before tar/zip * call zip w/ -X * make private_version deterministic * python3: add reproducible-buildinfo.diff patch (from Debian) Caveats: * still requires identical build path and umask * arm64-v8a requires ndk >= r22 to build completely reproducibly - due to a clang/llvm bug Makefile Example: NB: you need to export something like this in your build environment to get reproducible builds. export LC_ALL := C export TZ := UTC export SOURCE_DATE_EPOCH := $(shell git log -1 --pretty=%ct) export PYTHONHASHSEED := $(SOURCE_DATE_EPOCH) export BUILD_DATE := $(shell LC_ALL=C TZ=UTC date +'%b %e %Y' -d @$(SOURCE_DATE_EPOCH)) export BUILD_TIME := $(shell LC_ALL=C TZ=UTC date +'%H:%M:%S' -d @$(SOURCE_DATE_EPOCH))
7f95790
to
eafc5a9
Compare
Rebased & squashed. |
@AndreMiras where would be a good place to document this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks!
I would be very interested in building my apk reproducibly; any chance you have a list of things you needed to do? |
The code for my app (including build scripts & patches) is here. IIRC I needed:
# for reproducible builds
export LC_ALL := C
export TZ := UTC
export SOURCE_DATE_EPOCH := $(shell git log -1 --pretty=%ct)
export PYTHONHASHSEED := $(SOURCE_DATE_EPOCH)
export BUILD_DATE := $(shell LC_ALL=C TZ=UTC date +'%b %e %Y' -d @$(SOURCE_DATE_EPOCH))
export BUILD_TIME := $(shell LC_ALL=C TZ=UTC date +'%H:%M:%S' -d @$(SOURCE_DATE_EPOCH)) And of course sufficiently identical build environments (OS, packages, user, umask, build path). |
@SomberNight mind letting me know if you get it to work?
|
I just found out I get different Presumably this is what caused the differences between GitHub Actions and my focal VM. |
@AndreMiras I'd like to document this. What would be a good place/way to do that? |
Yeah good initiative, thank you! You could document it somewhere within https://github.com/kivy/python-for-android/tree/b809239/doc/source |
I've been a bit busy working on Reproducible Builds for F-Droid. But I intend to document this sometime soonish :) |
Another issue I've encountered is that |
@obfusk Thank you for your work, and for the instructions. |
Reproducible Builds
Current Status
armeabi-v7a
seems to consistently build reproduciblyusrmerge
)umask 022
).pyc
files ❌arm64-v8a
seems to consistently build reproducibly... but only with ndk r22 (clang 11.0.5)usrmerge
)umask 022
).pyc
files ❌arm64-v8a
builds almost reproducibly with other ndk versionsTODO
NB: can be done in subsequent PRs.
chmod
to fix file modes so umask is irrelevant-ffile-prefix-map=OLD=NEW
(with gcc & clang >= 10) to fix build path (though it may still be used elsewhere)Makefile Example
NB: you need to export something like this in your build environment to get reproducible builds.
Diff