#rpm #path #file #helper #modification #metadata #reproducible-builds

bin+lib add-determinism

RPM buildroot helper to strip nondeterministic bits in files

2 unstable releases

0.2.0 Apr 3, 2024
0.1.0 Mar 23, 2024

#422 in Filesystem

Download history 118/week @ 2024-03-22 127/week @ 2024-03-29 30/week @ 2024-04-05 2/week @ 2024-04-12

277 downloads per month

GPL-3.0-or-later

69KB
1K SLoC

Contains (static library, 2KB) tests/cases/testrelro.fixed.a, (static library, 1KB) tests/cases/libempty.a, (static library, 2KB) tests/cases/testrelro.a

Build postprocessor to reset metadata fields for build reproducibility

This crate provides a binary add-determinism that one or more paths, and will recursively process those paths, attempting to run the handlers on any files with extensions that match.

For each processed file, a temporary file is opened, the contents are rewritten, the modification timestamp is copied from the original file to the temporary copy, and the copy is renamed over the original.

If processing fails, a warning is emitted, but no modifications are made and the program returns success.

Processors

ar

Accepts *.a.

Resets the embedded modification times to $SOURCE_DATE_EPOCH and owner:group to 0:0.

jar

Accepts *.jar.

This rewrites the zip file using the zip create. The modification times of archive entries is clamped $SOURCE_DATE_EPOCH. Extra metadata, i.e. primarily timestamps in UNIX format and DOS permissions, are stripped (also because the crate does not support them).

javadoc

Accepts *.html.

This looks at the <head> portion of an HTML file and finds standard lines inserted by Javadoc that specify the file creation date. For example, <!-- Generated by javadoc (<version>) on <date> --> is replaced by a version without the version and date, and <meta name="dc.created" content="<date>"> is replaced by a version with $SOURCE_DATE_EPOCH.

pyc

Accepts *.pyc.

Uses the MarshalParser Python module to clean up the internal Python object serialization in cache files.

Notes

This project is inspired by strip-nondeterminism, but is written from scratch in Rust. For Debian, build tools are written in Perl and more Perl is not an issue. But in Fedora/RHEL/…, tools are written in Bash, Python, or compiled, and we don't want to pull in Perl into all buildroots.

Dependencies

~14–23MB
~329K SLoC