1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

Merge branch 'ofw-dev' into dev

This commit is contained in:
MX
2023-06-09 16:02:32 +03:00
10 changed files with 427 additions and 18 deletions

View File

@@ -47,12 +47,23 @@ class GitVersion:
if (force_no_dirty != ""):
dirty = False
if "SOURCE_DATE_EPOCH" in os.environ:
commit_date = datetime.utcfromtimestamp(
int(os.environ["SOURCE_DATE_EPOCH"])
)
else:
commit_date = datetime.strptime(
self._exec_git("log -1 --format=%cd").strip(),
"%a %b %d %H:%M:%S %Y %z",
)
return {
"GIT_COMMIT": commit,
"GIT_BRANCH": branch,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
"GIT_ORIGIN": ",".join(self._get_git_origins()),
"GIT_COMMIT_DATE": commit_date,
}
def _get_git_origins(self):
@@ -109,10 +120,11 @@ 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()
build_date = (
date.today()
if current_info["BUILD_DIRTY"]
else current_info["GIT_COMMIT_DATE"]
)
current_info.update(
{
@@ -122,6 +134,8 @@ class Main(App):
}
)
del current_info["GIT_COMMIT_DATE"]
version_values = []
for key in current_info:
val = current_info[key]