[FL-2832] fbt: more fixes & improvements (#1854)

* github: bundling debug folder with scripts; docs: fixes & updates; fbt: added FAP_EXAMPLES variable to enable building example apps. Disabled by default. fbt: added TERM to list of proxied environment variables
* fbt: better help output; disabled implicit_deps_unchanged; added color to import validator reports
* fbt: moved debug configuration to separate tool
* fbt: proper dependency tracker for SDK source file; renamed linker script for external apps
* fbt: fixed debug elf path
* fbt: packaging sdk archive
* scripts: fixed sconsdist.py
* fbt: reworked sdk packing; docs: updates
* docs: info on cli target; linter fixes
* fbt: moved main code to scripts folder
* scripts: packing update into .tgz
* fbt, scripts: reworked copro_dist to build .tgz
* scripts: fixed naming for archived updater package
* Scripts: fix ぐるぐる回る

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-10-12 20:12:05 +04:00
committed by GitHub
parent afff1adf8f
commit eb4ff3c0fd
41 changed files with 413 additions and 272 deletions

View File

@@ -1,10 +1,9 @@
import logging
import datetime
import shutil
import json
from os.path import basename
from io import BytesIO
import tarfile
import xml.etree.ElementTree as ET
from flipper.utils import *
from flipper.assets.coprobin import CoproBinary, get_stack_type
@@ -51,20 +50,19 @@ class Copro:
raise Exception(f"Unsupported cube version")
self.version = cube_version
@staticmethod
def _getFileName(name):
return os.path.join("core2_firmware", name)
def addFile(self, array, filename, **kwargs):
source_file = os.path.join(self.mcu_copro, filename)
destination_file = os.path.join(self.output_dir, filename)
shutil.copyfile(source_file, destination_file)
array.append(
{"name": filename, "sha256": file_sha256(destination_file), **kwargs}
)
self.output_tar.add(source_file, arcname=self._getFileName(filename))
array.append({"name": filename, "sha256": file_sha256(source_file), **kwargs})
def bundle(self, output_file, stack_file_name, stack_type, stack_addr=None):
self.output_tar = tarfile.open(output_file, "w:gz")
def bundle(self, output_dir, stack_file_name, stack_type, stack_addr=None):
if not os.path.isdir(output_dir):
raise Exception(f'"{output_dir}" doesn\'t exists')
self.output_dir = output_dir
stack_file = os.path.join(self.mcu_copro, stack_file_name)
manifest_file = os.path.join(self.output_dir, "Manifest.json")
# Form Manifest
manifest = dict(MANIFEST_TEMPLATE)
manifest["manifest"]["timestamp"] = timestamp()
@@ -105,6 +103,10 @@ class Copro:
stack_file_name,
address=f"0x{stack_addr:X}",
)
# Save manifest to
with open(manifest_file, "w", newline="\n") as file:
json.dump(manifest, file)
# Save manifest
manifest_data = json.dumps(manifest, indent=4).encode("utf-8")
info = tarfile.TarInfo(self._getFileName("Manifest.json"))
info.size = len(manifest_data)
self.output_tar.addfile(info, BytesIO(manifest_data))
self.output_tar.close()