Add some checks for valid env (#20805)

This commit is contained in:
Jason2866 2024-02-25 20:28:30 +01:00 committed by GitHub
parent 7402fe06fd
commit 3dcd8d7f13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 8 deletions

View File

@ -126,11 +126,21 @@ def patch_partitions_bin(size_string):
print("New partition hash:",result.digest().hex())
def esp32_create_chip_string(chip):
tasmota_platform = env.subst("$BUILD_DIR").split(os.path.sep)[-1]
tasmota_platform = tasmota_platform.split('-')[0]
if 'tasmota' + chip[3:] not in tasmota_platform: # quick check for a valid name like 'tasmota' + '32c3'
print('Unexpected naming conventions in this build environment -> Undefined behavior for further build process!!')
tasmota_platform_org = env.subst("$BUILD_DIR").split(os.path.sep)[-1]
tasmota_platform = tasmota_platform_org.split('-')[0]
if "tasmota" + chip[3:] not in tasmota_platform: # quick check for a valid name like 'tasmota' + '32c3'
print("Unexpected naming convention in this build environment:", tasmota_platform_org)
print("Expected build environment name like 'tasmota32-whatever-you-want'")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!")
if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform:
tasmota_platform += "cdc"
print("WARNING: board definition uses CDC configuration, but environment name does not -> adding 'cdc' to environment name")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!")
if ("CORE32SOLO1" in extra_flags or "FRAMEWORK_ARDUINO_SOLO1" in build_flags) and "tasmota32solo1" not in tasmota_platform_org:
print("Unexpected naming convention in this build environment:", tasmota_platform_org)
print("Expected build environment name like 'tasmota32solo1-whatever-you-want'")
print("Please correct your actual build environment, to avoid undefined behavior in build process!!")
tasmota_platform = "tasmota32solo1"
return tasmota_platform
def esp32_build_filesystem(fs_size):
@ -222,10 +232,6 @@ def esp32_create_combined_bin(source, target, env):
firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin")
tasmota_platform = esp32_create_chip_string(chip)
if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform:
tasmota_platform += "cdc"
print("WARNING: board definition uses CDC configuration, but environment name does not -> changing tasmota safeboot binary to:", tasmota_platform + "-safeboot.bin")
if not os.path.exists(variants_dir):
os.makedirs(variants_dir)
if "safeboot" in firmware_name: