-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Reproducible builds #447
Comments
I think there is more to that as if I recall correctly the data of creation is might be added somewhere as a header or metadata, which is also what Composer does. The hash you are pointing at is for the lock file only, not the Composer PHAR itself which is not reproducible either. That said I'm not against the idea of switching to reproducible builds by default. It does also mean that when using PHP-Scoper, the prefix used should be deterministic as well |
Definitely. The rest is also different but this is the most obvious difference.
Of course. $ rm -rf vendor composer.lock
$ composer update
$ grep content-hash composer.lock
"content-hash": "7f80fc47150ea0d769c4a2797c070a40",
$ rm -rf vendor composer.lock
$ composer update
$ grep content-hash composer.lock
"content-hash": "7f80fc47150ea0d769c4a2797c070a40", |
/cc @ondrejmirtes |
I've managed to get to a 100% reproducible build 🎉 This is the recipe:
|
Revisiting this issue. From this I think there is two actionables:
I am also wondering if this is it. Are you using your own stub as well or something? Because I would guess otherwise the standard stub would be a problem (due to the random alias) |
I had to look up what "stub file" is in context of a PHAR file :) There's no specific stub setting in my Box configuration (https://github.com/phpstan/phpstan-src/blob/d194a471f9a88d4da0ae756c6664b008cf48b03c/compiler/build/box.json) and if I inspect the PHAR file to see how the stub looks like, there's nothing random in it: #!/usr/bin/env php
<?php
Phar::mapPhar('phpstan.phar');
require 'phar://phpstan.phar/bin/phpstan';
__HALT_COMPILER(); ?> |
aha yes, but you have |
Feature Request
If
box compile
is run multiple times on the same sources using the same configuration, it produces different results:One of the factors is the usage of
random_bytes()
to generate the stub alias:https://github.com/humbug/box/blob/efe97a7d48169d01b776cdfb1d43608cad3f13c2/src/Configuration/Configuration.php#L853-L855
When it comes to automation, it's important that the same sources produce the same artifacts in order to not build the same things over and over. See https://reproducible-builds.org/ for more details.
Instead of using random bytes, Box could use an approach similar to the one used in Composer and hash all the sources used during the build.
The text was updated successfully, but these errors were encountered: