Skip to content
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

ruby: make the build reproducible #101655

Merged
merged 2 commits into from Oct 27, 2020
Merged

ruby: make the build reproducible #101655

merged 2 commits into from Oct 27, 2020

Conversation

@zimbatm
Copy link
Member

@zimbatm zimbatm commented Oct 25, 2020

Motivation for this change

ext/io/console/io-console.gemspec was embedding a timestamp which made
the build not reproducible. Gems respect SOURCE_DATE_EPOCH so it's
enough to just delete that line if it exists.

This file has been fixed in
ruby/io-console@679a941#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6
And then ruby regularly merges that gem into their own repository. Ruby
master is fixed but none of the ruby releases have been fixed yet.

lib/ruby/gems/2.6.0/specifications/default/io-console-0.4.7.gemspec now
contains:

s.date = "1980-01-01"
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@zimbatm zimbatm requested a review from alyssais as a code owner Oct 25, 2020
@zimbatm
Copy link
Member Author

@zimbatm zimbatm commented Oct 25, 2020

@nlewo I found your previous attempt of 2 years ago: rubygems/rubygems#2481

@zimbatm
Copy link
Member Author

@zimbatm zimbatm commented Oct 25, 2020

Running nixpkgs-review. It's going to take a while.

Ma27
Ma27 approved these changes Oct 25, 2020
@zimbatm
Copy link
Member Author

@zimbatm zimbatm commented Oct 27, 2020

when the build finally finished, nixpkgs-review spitted out a bunch of errors like this:

bash: /nix/store/ny7vshs45d5k193ql3b51dak0hjwwqc2-findutils-4.7.0/bin/find: Argument list too long
bash: /nix/store/7fdm1ij6f7xwjmhpici1bh3xh08n0sp7-coreutils-8.31/bin/basename: Argument list too long
bash: /nix/store/4crjhnvd8yhk063r7pwxpw6kd8aq0rbv-gnugrep-3.5/bin/grep: Argument list too long

It looks like nixpkgs-review doesn't work if there are more than 1024 outputs being rebuilt.

@zimbatm
Copy link
Member Author

@zimbatm zimbatm commented Oct 27, 2020

since the rebuild is fairly large I will rebase this on staging

zimbatm added 2 commits Oct 27, 2020
ext/io/console/io-console.gemspec was embedding a timestamp which made
the build not reproducible. Gems respect SOURCE_DATE_EPOCH so it's
enough to just delete that line if it exists.

This file has been fixed in
ruby/io-console@679a941#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6
And then ruby regularly merges that gem into their own repository. Ruby
master is fixed but none of the ruby releases have been fixed yet.

lib/ruby/gems/2.6.0/specifications/default/io-console-0.4.7.gemspec now
contains:

    s.date = "1980-01-01"
The generated Makefile is not reproducible. The HDRS section is inode
dependent. "sitearchdir" and "sitelibdir" contains a timestamp and
random postfix. See https://r13y.com/diff/8350ec80865096f84705f3e000d97f151760e768bf626e52c84570413c5e1093-f9dea788fe62d683e90e12e166f29b778c39c699a5be39f9262e5cffb77d3e45.html

Instead of trying to make it reproducible, remove it entirely. It was
only useful for generating the .so file and it no longer needed.

See also https://bugs.ruby-lang.org/issues/15304

Fixes the rubyPackages.nokogiry reproducibility for example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants