build: add ability to override date in pkgver when building from custom source

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-06-16 19:06:02 +03:00 committed by Kitsune (Rebase Bot)
parent 3c1699b5c1
commit b68da2783e
2 changed files with 6 additions and 1 deletions

View file

@ -26,3 +26,7 @@ password is written to a temporary file and can be read from
`/proc/<pid>/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`

View file

@ -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