fsfe / reuse-tool

reuse is a tool for compliance with the REUSE recommendations.
https://reuse.software
399 stars 148 forks source link

Fix `Created` field format in bill of materials #939

Closed smortex closed 6 months ago

smortex commented 7 months ago

When generating a Bill Of Materials, the SPDX specification for the Created field expect the date with format YYYY-MM-DDThh:mm:ssZ.

The current implementation does the transformation to express the current time in UTC, but this has the side effect to add +00:00 at the end of the date when formatting it. The resulting date YYYY-MM-DDThh:mm:ss+00:00Z does not match the SPDX specification and validation using the SPDX online tools fail because of this invalid format.

Make sure to remove tzinfo from the date so that time zone information is not output when formatting the date, so that we can safely append a Z at the end to indicate UTC time-zone.

Other formats for the time-zone (e.g. +00:00) is not allowed by the SPDX specification.

Fixes: #918

carmenbianca commented 6 months ago

Ah, I hadn't spotted this PR before merging #952. I like your test, though. I will cherrypick it.

Thanks a lot for your contribution @smortex !