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.
$ add-determinism /path/to/file /path/to/directory
Note that the program works in-place, replacing input files with the rewritten versions (if any modifications are made).
Some useful options:
-v
— enable debug output-j [N]
— useN
workers (or as many as CPUs, ifN
is not given)--handler list|HANDLER|-HANDLER
— constrain the list of handlers. Takes a comma-separated list of names, either a list of "positive" names, in which case only listed handlers will be used, or a list of "negative" names, each prefixed by minus, in which case the listed handlers will not be used. By default, handlers that cannot be initialized are skipped with a warning. If a "positive" list is given, failure to initialize a handler will cause an error. The special valuelist
can be used to list known handlers.--brp
— enable "build root program" mode, see below.
When invoked with --brp
, the $RPM_BUILD_ROOT
environment variable must be defined and not empty. All arguments must be below $RPM_BUILD_ROOT
. This option is intended to be used in rpm macros that define post-install steps. See redhat-rpm-config pull request #293 for a draft pull request that does this.
Accepts *.a
.
Resets the embedded modification times to $SOURCE_DATE_EPOCH
and owner:group to 0:0.
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).
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
.
Accepts *.pyc
.
Uses the MarshalParser Python module to clean up the internal Python object serialization in cache files.
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.