diff --git a/docs/environment_variables.md b/docs/environment_variables.md index 72f2026e..f7fe2c93 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -26,3 +26,7 @@ password is written to a temporary file and can be read from `/proc//environ`. Make sure you are aware of the security implications, consider using this feature only with test passwords or in environments such as live operating systems running in memory. + +## `PMB_VER_DATE` + +This variable can be used to override date string when building package using `--src` diff --git a/pmb/build/_package.py b/pmb/build/_package.py index a3e4b12d..2192d4c1 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -3,6 +3,7 @@ import datetime import functools import operator +import os from typing import Any, TypedDict from collections.abc import Callable from pmb.build.other import BuildStatus @@ -115,7 +116,7 @@ def get_pkgver(original_pkgver: str, original_source: bool = False) -> str: # Append current date no_suffix = original_pkgver.split("_", 1)[0] now = datetime.datetime.now() - new_suffix = "_p" + now.strftime("%Y%m%d%H%M%S") + new_suffix = "_p" + os.getenv("PMB_VER_DATE", now.strftime("%Y%m%d%H%M%S")) return no_suffix + new_suffix