mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
fbt: Respect SOURCE_DATE_EPOCH when setting build date (#1421)
* fbt: using SOURCE_DATE_EPOCH from environment for build timestamp (if set) Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
parent
e3c7201a20
commit
ec57dd310a
1 changed files with 8 additions and 2 deletions
|
@ -5,7 +5,7 @@ from flipper.app import App
|
|||
import subprocess
|
||||
import os
|
||||
import json
|
||||
from datetime import date
|
||||
from datetime import date, datetime
|
||||
|
||||
|
||||
class GitVersion:
|
||||
|
@ -77,9 +77,15 @@ class Main(App):
|
|||
|
||||
def generate(self):
|
||||
current_info = GitVersion(self.args.sourcedir).get_version_info()
|
||||
|
||||
if "SOURCE_DATE_EPOCH" in os.environ:
|
||||
build_date = datetime.utcfromtimestamp(int(os.environ["SOURCE_DATE_EPOCH"]))
|
||||
else:
|
||||
build_date = date.today()
|
||||
|
||||
current_info.update(
|
||||
{
|
||||
"BUILD_DATE": date.today().strftime("%d-%m-%Y"),
|
||||
"BUILD_DATE": build_date.strftime("%d-%m-%Y"),
|
||||
"TARGET": self.args.target,
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue