1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 20:59:50 +04:00

[FL-3330] fbt: added hooks for build & dist environments; added FW_ORIGIN_* macro for apps & SDK (#2705)

* fbt: added hooks for build & dist environments
* Moved env hooks to an optional file
* Fixed var name
* Added fw origin to device info
* Bumped device info version
* fbt: added FIRMWARE_ORIGIN option. Different implementation for FW_ORIGIN_* C macro.
* api: bumped versions
* fbt: added fbt_options_local.py
* gitignore: cleanup

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2023-05-29 20:40:56 +04:00
committed by GitHub
parent 3de856f8d5
commit 8d2ea14f06
16 changed files with 206 additions and 17 deletions

View File

@@ -45,8 +45,23 @@ class GitVersion:
"GIT_BRANCH": branch,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
"GIT_ORIGIN": ",".join(self._get_git_origins()),
}
def _get_git_origins(self):
try:
remotes = self._exec_git("remote -v")
except subprocess.CalledProcessError:
return set()
origins = set()
for line in remotes.split("\n"):
if not line:
continue
_, destination = line.split("\t")
url, _ = destination.split(" ")
origins.add(url)
return origins
def _exec_git(self, args):
cmd = ["git"]
cmd.extend(args.split(" "))
@@ -74,6 +89,13 @@ class Main(App):
help="hardware target",
required=True,
)
self.parser_generate.add_argument(
"-fw-origin",
dest="firmware_origin",
type=str,
help="firmware origin",
required=True,
)
self.parser_generate.add_argument("--dir", dest="sourcedir", required=True)
self.parser_generate.set_defaults(func=self.generate)
@@ -89,6 +111,7 @@ class Main(App):
{
"BUILD_DATE": build_date.strftime("%d-%m-%Y"),
"TARGET": self.args.target,
"FIRMWARE_ORIGIN": self.args.firmware_origin,
}
)