-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reproducible builds (#2)
* Add support for reproducible builds See [1] for more info about reproducible builds. In case of zip files we need to adjust timestamps. After this change, each built zip archive will have same hash (as long as packaged files do not change) [1] https://hatch.pypa.io/latest/config/build/#reproducible-builds * refactor(tests): add separate tests for reproducible builds * refactor(ZipArchive.add_file): do not read large files into memory * fix(ZipArchive.add_file): normalize file mode bits in reproducible mode * docs: update README and CHANGES --------- Co-authored-by: Jeff Dairiki <[email protected]>
- Loading branch information
Showing
4 changed files
with
193 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,21 @@ structure: | |
└── more-code.py | ||
``` | ||
|
||
## Reproducible Builds | ||
|
||
By default, this plugin attempts to build [reproducible][reproducible | ||
builds] archives by setting the timestamps of the zip entries to a | ||
fixed value. When building in reproducible mode, the UNIX file modes | ||
of the archive entries is also normalized (to either 0644 or 0755 | ||
depending on whether the file is executable.) | ||
|
||
The timestamp used for reproducible builds may be configured by | ||
setting the `SOURCE_DATE_EPOCH` environment variable. | ||
|
||
Reproducible builds may be disabled by setting `reproducible = false` | ||
in an appropriate section of `pyproject.toml` or `hatch.toml`. See | ||
Hatch’s documentation on [Build Configuration] for details. | ||
|
||
|
||
## Author | ||
|
||
|
@@ -101,3 +116,6 @@ Jeff Dairiki <[email protected]> | |
|
||
`hatch-zipped-directory` is distributed under the terms of the | ||
[MIT](https://spdx.org/licenses/MIT.html) license. | ||
|
||
[reproducible builds]: https://hatch.pypa.io/latest/config/build/#reproducible-builds | ||
[Build Configuration]: https://hatch.pypa.io/latest/config/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters