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
@ -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 New Issue
Block a user