Skip to content

Honor SOURCE_DATE_EPOCH for the rpm %changelog date - #2155

Open
linus-mullvad wants to merge 1 commit into
jordansissel:mainfrom
linus-mullvad:fix-rpm-changelog-source-date-epoch
Open

Honor SOURCE_DATE_EPOCH for the rpm %changelog date#2155
linus-mullvad wants to merge 1 commit into
jordansissel:mainfrom
linus-mullvad:fix-rpm-changelog-source-date-epoch

Conversation

@linus-mullvad

Copy link
Copy Markdown

Fixes #2154

FPM::Package::RPM#changelog reads attributes[:source_date_epoch], but the only code resolving --source-date-epoch-default (and thus the SOURCE_DATE_EPOCH environment variable) into that attribute lived in FPM::Package::Deb#output. So the rpm output dated the entry it generates from the wall clock, and since rpm parses that date into the CHANGELOGTIME header, the same input packaged on two different days produced two different rpms.

Move the precedence into FPM::Package#source_date_epoch, so every package type gets the same answer, and read that from the deb and rpm code. An input type that discovers a release date of its own still wins, as FPM::Package::Gem does.

The deb changelog and .changes templates read the attribute directly and relied on Deb#output having overwritten it first, so they read the accessor now too. Without that they would have gone back to dating themselves from the wall clock.

Also format these dates in UTC. SOURCE_DATE_EPOCH is defined as UTC, but strftime rendered it in the local time zone, so a build machine east of UTC could name the following day. Only the fixed-epoch case changes; when no epoch is given the timestamp is still local wall clock time.

FPM::Package::RPM#changelog reads attributes[:source_date_epoch], but the
only code resolving --source-date-epoch-default (and thus the
SOURCE_DATE_EPOCH environment variable) into that attribute lived in
FPM::Package::Deb#output. So the rpm output dated the entry it generates
from the wall clock, and since rpm parses that date into the
CHANGELOGTIME header, the same input packaged on two different days
produced two different rpms.

Move the precedence into FPM::Package#source_date_epoch, so every
package type gets the same answer, and read that from the deb and rpm
code. An input type that discovers a release date of its own still wins,
as FPM::Package::Gem does.

The deb changelog and .changes templates read the attribute directly and
relied on Deb#output having overwritten it first, so they read the
accessor now too. Without that they would have gone back to dating
themselves from the wall clock.

Also format these dates in UTC. SOURCE_DATE_EPOCH is defined as UTC, but
strftime rendered it in the local time zone, so a build machine east of
UTC could name the following day. Only the fixed-epoch case changes; when
no epoch is given the timestamp is still local wall clock time.
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.

rpm output ignores SOURCE_DATE_EPOCH when generating the %changelog date

1 participant