1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-29 01:58:26 +00:00

Allow custom man build date via SOURCE_DATE_EPOCH (#2096)

Allows making man1/conky.1 in builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Also use UTC to be independent of timezone.
This commit is contained in:
Bernhard M. Wiedemann 2024-11-30 19:16:00 +01:00 committed by GitHub
parent 15024a0095
commit 1a8e49d9ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@
import sys
import os
import time
import yaml
import datetime
@ -16,12 +17,16 @@ with open(os.path.join(base_path, "variables.yaml")) as file:
with open(os.path.join(base_path, "lua.yaml")) as file:
lua = yaml.safe_load(file)
build_date = datetime.datetime.fromtimestamp(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
tz=datetime.timezone.utc,
)
data = {
"config_settings": config_settings,
"variables": variables,
"lua": lua,
"date": datetime.date.today().isoformat(),
"copyright_year": datetime.date.today().year,
"date": build_date.date().isoformat(),
"copyright_year": build_date.year,
}
from jinja2 import Environment, FileSystemLoader, select_autoescape