Source: rocm-docs-core Version: 1.35.0-3 Severity: wishlist Tags: patch User: [email protected] Usertags: timestamps X-Debbugs-Cc: [email protected]
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that rocm-docs-core could not be built reproducibly. This is because it embeds the timestamps of various files based on their modification times into the documentation. A patch is attached that will prefer SOURCE_DATE_EPOCH if this variable is available. This should almost certainly be merged into your existing debian/patches/0003-Don-t-fail-if-not-in-git-repo.patch patch, but I thought it would be easier to read and review here if I did that already. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` [email protected] / chris-lamb.co.uk `-
--- a/debian/patches/0007-Reproducible-build.patch 1969-12-31 16:00:00.000000000 -0800 --- b/debian/patches/0007-Reproducible-build.patch 2026-06-17 07:42:46.043093092 -0700 @@ -0,0 +1,36 @@ +Description: Make the build reproducible +Author: Chris Lamb <[email protected]> +Last-Update: 2026-06-17 + +--- rocm-docs-core-1.35.0.orig/src/rocm_docs/article_info.py ++++ rocm-docs-core-1.35.0/src/rocm_docs/article_info.py +@@ -85,8 +85,12 @@ def _set_page_article_info( + date_info = page["date"] + else: + if "ROCM_DOCS_NO_GIT" in os.environ: +- logger.debug("Disabling GIT query for date, use timestamp : %s", path_source) +- date_info = datetime.datetime.utcfromtimestamp(os.path.getmtime(path_source)).strftime("%Y-%m-%d") ++ logger.debug("Disabling GIT query for date, using SOURCE_DATE_EPOCH or timestamp of : %s", path_source) ++ try: ++ timestamp = int(os.environ["SOURCE_DATE_EPOCH"]) ++ except (KeyError, ValueError): ++ timestamp = os.path.getmtime(path_source) ++ date_info = datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc).strftime("%Y-%m-%d") + else: + date_info = _get_time_last_modified(repo, path_source) + +@@ -157,8 +161,12 @@ def _set_all_article_info( + article_os_info = f"Applies to {article_os_info}" + + if "ROCM_DOCS_NO_GIT" in os.environ: +- logger.debug("Disabling GIT query for date, use timestamp : %s", Path(app.srcdir, page_rel)) +- date_info = datetime.datetime.utcfromtimestamp(os.path.getmtime(Path(app.srcdir, page_rel))).strftime("%Y-%m-%d") ++ logger.debug("Disabling GIT query for date, usinng SOURCE_DATE_EPOCH or timestamp of : %s", Path(app.srcdir, page_rel)) ++ try: ++ timestamp = int(os.environ["SOURCE_DATE_EPOCH"]) ++ except (KeyError, ValueError): ++ timestamp = os.path.getmtime(Path(app.srcdir, page_rel)) ++ date_info = datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc).strftime("%Y-%m-%d") + else: + date_info = _get_time_last_modified(repo, Path(app.srcdir, page_rel)) + --- a/debian/patches/series 2026-06-17 07:32:07.380940708 -0700 --- b/debian/patches/series 2026-06-17 07:38:03.237636265 -0700 @@ -3,3 +3,4 @@ 0006-Fix-linking-toc.patch 0004-Merge-Get-data-from-env-and-Add-option-to-skip-theme.patch 0005-skip-get_rocm_toolkits-when-offline-sphinx.patch +0007-Reproducible-build.patch

