Skip to content

Commit

Permalink
build: Fix zipball build after Composer bump
Browse files Browse the repository at this point in the history
Composer 2.6.4+ wants to have reproducible outputs so it preserves `mtime` when copying files:
composer/composer#11663
This becomes an issue with `vendor/composer/ClassLoader.php`,
which is copied from Nix store so it has `mtime` of 0 (1970-01-01),
because that is not supported by ZIP:

    ValueError: ZIP does not support timestamps before 1980

Let’s disable strict timestamps to clamp the out-of-range timestamps to ZIP epoch.
That argument was actually introduced because of reproducible builds:
https://bugs.python.org/issue34097
  • Loading branch information
jtojnar committed Feb 17, 2024
1 parent d7b4a20 commit 31ad2de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/create-zipball.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def main():
subprocess.check_call(['composer', 'install', '--no-dev', '--optimize-autoloader'])

# fill archive with data
with ZipFile(source_dir / filename, 'w', zipfile.ZIP_DEFLATED) as archive:
with ZipFile(
source_dir / filename,
'w',
zipfile.ZIP_DEFLATED,
strict_timestamps=False,
) as archive:
archive.prefix = Path('entries')

# Assets are copied by Webpack to www/dist/.
Expand Down

0 comments on commit 31ad2de

Please sign in to comment.