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

Make the generated .cmake files reproducible. #9602

Conversation

lamby
Copy link
Contributor

@lamby lamby commented Nov 21, 2021

Whilst working on the Reproducible Builds effort, I noticed that meson did not generate reproducible .cmake files: they include the full path name. This commit not only makes the build reproducible, but it also matches CMake's own behaviour. Specifically, CMakePackageConfigHelpers.cmake does the equivalent transformation using get_filename_component(inputFileName "${_inputFile}" NAME).

I originally filed this in Debian as bug #1000327.

Whilst working on the Reproducible Builds effort [0], I noticed that meson did
not generate reproducible .cmake files: they include the full path name.

This commit not only makes the build reproducible, but it also matches CMake's
own behaviour. Specifically, CMakePackageConfigHelpers.cmake does the
equivalent transformation using:

    get_filename_component(inputFileName "${_inputFile}" NAME)

I originally filed this in Debian as bug #1000327 [1].

 [0] https://reproducible-builds.org/
 [1] https://bugs.debian.org/1000327
@lamby lamby requested a review from mensinda as a code owner November 21, 2021 17:52
Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that makes a lot of sense... I wonder why this used the whole path in the first place, the cmake module does try to explicitly copy cmake's output.

@lamby
Copy link
Contributor Author

lamby commented Nov 21, 2021

Perhaps it doesn't usually matter in that infile is usually relative? Either way, its pretty harmless as it's commented anyway. :)

@codecov
Copy link

codecov bot commented Nov 21, 2021

Codecov Report

Merging #9602 (940c13c) into master (809792c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9602      +/-   ##
==========================================
- Coverage   67.41%   67.41%   -0.01%     
==========================================
  Files         402      402              
  Lines       85478    85478              
  Branches    17620    17620              
==========================================
- Hits        57626    57625       -1     
- Misses      23245    23246       +1     
  Partials     4607     4607              
Impacted Files Coverage Δ
mesonbuild/modules/cmake.py 71.96% <100.00%> (ø)
mesonbuild/scripts/vcstagger.py 87.50% <0.00%> (-4.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 809792c...940c13c. Read the comment docs.

@eli-schwartz
Copy link
Member

We literally mention Any changes to this file will be overwritten by the next CMake run which is untrue as it will be overwritten by the next meson run... that is an irrelevant comment too. :D

Over in my neck of the woods this sort of variation isn't actually tested as build paths are predictable. :/ Thanks for the catch.

@eli-schwartz eli-schwartz merged commit 958b1a7 into mesonbuild:master Nov 21, 2021
36 checks passed
@lamby lamby changed the title Make the generated reproducible .cmake files reproducible. Make the generated .cmake files reproducible. Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants