Skip to content

Add a reproducibility option for building ecodes.c #242

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

Merged
merged 1 commit into from
May 1, 2025

Conversation

ycongal-smile
Copy link
Contributor

ecodes.c currently contains the kernel info of the build machine and the full path of the input*.h headers: This is not reproducible as output can change even is headers content do not. Downstream distributions might package ecodes.c and get non-reproducible output.

To fix this: introduce a --reproducible option in the build:

  • in setup.py build_ecodes command
  • in underlying genecodes_c.py

Note: These options are disabled by default so no change is expected in current builds.

Here is a sample of the ecodes.c output:

 $ python -m build --config-setting=--build-option='build_ecodes' -n >/dev/null 2>&1; cat src/evdev/ecodes.c |grep Generated
/* Generated on   Linux 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07) x86_64 */
/* Generated from ['/usr/include/linux/input.h', '/usr/include/linux/input-event-codes.h', '/usr/include/linux/uinput.h'] */

 $ python -m build --config-setting=--build-option='build_ecodes --reproducibility' -n >/dev/null 2>&1; cat src/evdev/ecodes.c |grep Generated
/* Generated on   hidden for reproducibility */
/* Generated from ['hidden for reproducibility'] */

ecodes.c currently contains the kernel info of the build machine and the
full path of the input*.h headers: This is not reproducible as output
can change even is headers content do not. Downstream distributions
might package ecodes.c and get non-reproducible output.

To fix this: introduce a --reproducible option in the build:
- in setup.py build_ecodes command
- in underlying genecodes_c.py

Note: These options are disabled by default so no change is expected in
current builds.

Signed-off-by: Yoann Congal <[email protected]>
@ssieb
Copy link

ssieb commented Apr 12, 2025

I can see removing the timestamps and kernel version, but not the headers. That's somewhat important info and shouldn't change.

@ycongal-smile
Copy link
Contributor Author

I should have mentioned that I come from the Yocto project (embedded software), in this cross-compiling environment : the targeted headers are not the system headers and come from a very user specific path (often deep in the home of the user). Writing this path to a file cause us reproducibility issue (hence this PR).

@gvalkov gvalkov merged commit 6b4e8ef into gvalkov:main May 1, 2025
8 checks passed
@gvalkov
Copy link
Owner

gvalkov commented May 1, 2025

Thank you for the contribution - I'm happy to hear that this project is being used in Yocto. I hope you don't mind that I changed --reproducibility to --reproducible in b917479.

@ycongal-smile
Copy link
Contributor Author

ycongal-smile commented May 1, 2025

Thank you for the contribution - I'm happy to hear that this project is being used in Yocto. I hope you don't mind that I changed --reproducibility to --reproducible in b917479.

I don't mind at all. I will upgrade to 1.9.2 and switch to --reproducible.
Thanks!

@ycongal-smile ycongal-smile deleted the repro branch May 1, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants