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

Ability to create reproducable builds #117

Closed
dralley opened this issue Apr 8, 2023 · 7 comments
Closed

Ability to create reproducable builds #117

dralley opened this issue Apr 8, 2023 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dralley
Copy link
Collaborator

dralley commented Apr 8, 2023

We need to have the same knobs that rpmbuild has to enable reproducible package builds. Timestamps and various other things get in the way.

As far as I know the needed features are (equivalents to):

# Have SOURCE_DATE_EPOCH value set
%source_date_epoch_from_changelog 1
# Ensure no file timestamps are later than SOURCE_DATE_EPOCH
%clamp_mtime_to_source_date_epoch 1
# Force build timestamp to SOURCE_DATE_EPOCH
%use_source_date_epoch_as_buildtime 1
# Make the hostname deterministic
%_buildhost mockbuild

SOURCE_DATE_EPOCH is referring to https://reproducible-builds.org/docs/source-date-epoch/

@dralley dralley added enhancement New feature or request good first issue Good for newcomers labels Apr 10, 2023
@dralley
Copy link
Collaborator Author

dralley commented Apr 10, 2023

SOURCE_DATE_EPOCH support is now implemented but in a slightly different way from rpmbuild. If the environment variable is set and parses correctly, we just use it, whereas rpmbuild has a separate flag for enabling it that you have to configure.

We don't currently have a way to clamp file mtimes, nor use the most recent changelog timestamp as the build timestamp. Maybe it makes sense to put all of this behind one "reproducable" option on RPMBuilder?

Open for discussion.

@drahnr
Copy link
Contributor

drahnr commented Apr 14, 2023

I think the default should be to build reproducible rpms, the user then can opt in to provide i.e. the current timestamp or file timestamps or buildhost they desire. This would also enable the option to shed a few dependencies for i.e. the buildhost since the user would have to provide it, we don't need to have a dependency on the gethostname crate.

@dralley
Copy link
Collaborator Author

dralley commented Apr 14, 2023

I'm told that in practice those fields are quite useful for debugging purposes, so it's actually useful to opt-in to reproducibility rather than the other way around. But I don't build RPMs myself frequently, so I can't validate that with personal experience.

@dralley
Copy link
Collaborator Author

dralley commented Apr 14, 2023

However, I can presume that is with regards to rpmbuild. Programmatically generating RPMs is slightly different.

@dralley
Copy link
Collaborator Author

dralley commented Apr 14, 2023

If you want to take this issue and 5cfc3be#diff-b82882f602be2cf2d09fd6546c2097235d9417da83223e9516b8eb783c6257ffR233 and work on it, then that is fine with me.

@dralley
Copy link
Collaborator Author

dralley commented May 27, 2023

@drahnr How do you think

# Ensure no file timestamps are later than SOURCE_DATE_EPOCH
%clamp_mtime_to_source_date_epoch 1

ought to be handled, if at all. Basically you could rewrite the same bit-identical file (if this were part of some build pipeline) which would still end up changing the resulting package. The mtime is derived from the file on our end, so it's not possible to work around.

@dralley
Copy link
Collaborator Author

dralley commented Jun 2, 2023

I'm going to close this on the basis of reproducible builds being possible (the title is satisfied), although we should continue to improve the ergonomics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants