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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ycongal-smile
Copy link

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
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).

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.

2 participants