diff --git a/.github/workflows/carbonix_build.yml b/.github/workflows/carbonix_build.yml index 957e417cb1..c532bef513 100644 --- a/.github/workflows/carbonix_build.yml +++ b/.github/workflows/carbonix_build.yml @@ -321,7 +321,11 @@ jobs: - name: Run aircraft_config.py run: | python Tools/Carbonix_scripts/aircraft_config.py "libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/${{ matrix.xml_file }}.xml" "${{ env.commit_id }}" - ls -la final-output/*/ || echo "No files found" + # Check if the folder exists if not skip the next steps + if [ ! -d "final-output" ]; then + echo "No final-output folder found, skipping the next steps" + exit 0 + fi - name: Install AWS CLI run: | @@ -529,5 +533,7 @@ jobs: - name: Upload zipped folder to S3 run: | PATH_TO_S3=${{ needs.setup-s3-path.outputs.s3_path }} + # Remove trailing slash if it exists + PATH_TO_S3=${PATH_TO_S3%/} echo "Uploading to: $PATH_TO_S3" aws s3 cp ${{ env.folder_name }}.zip $PATH_TO_S3/${{ env.folder_name }}.zip diff --git a/Tools/Carbonix_scripts/aircraft_config.py b/Tools/Carbonix_scripts/aircraft_config.py index 0dae0d95fe..7fdcbf3be0 100644 --- a/Tools/Carbonix_scripts/aircraft_config.py +++ b/Tools/Carbonix_scripts/aircraft_config.py @@ -231,6 +231,27 @@ def build_flight_controller_firmware(board_name : str) -> None: raise RuntimeError(f"Error building firmware for {board_name}") +def check_config_status(xml_file : str) -> bool: + """Check the status of the aircraft configuration. + + Args: + xml_file (str): Path to the XML file. + Returns: + bool: False if the configuration is deprecated, True otherwise. + """ + tree = ET.parse(xml_file) + root = tree.getroot() + + aircraft = root.find('aircraft') + if aircraft is None: + raise AssertionError(f"'aircraft' element not found in {xml_file}") + + status = aircraft.find('status') + if status is None: + raise AssertionError(f"'status' element not found in the 'aircraft' element of {xml_file}") + + return status.text == 'active' + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('xml_file', help='Path to the XML file') @@ -240,7 +261,11 @@ def build_flight_controller_firmware(board_name : str) -> None: print('XML file:', args.xml_file) print('Commit ID:', args.commit_id) - + + if not check_config_status(args.xml_file): + print('Aircraft configuration is deprecated. No further action needed.') + exit(0) + xml_file = copy_configuration_file(args.xml_file, args.commit_id) copy_lua_scripts(xml_file) fc_board_name = get_flight_controller_board_name(xml_file) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_1.xml b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_1.xml index 8f441aceb1..56f6c30bc1 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_1.xml +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_1.xml @@ -17,6 +17,7 @@ CAN Airspeed, CAN Battery Monitor + deprecated 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_2.xml b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_2.xml index c565c47b38..df3fa23a7e 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_2.xml +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Ottano_AC_2.xml @@ -17,6 +17,7 @@ CAN Airspeed, CAN Battery Monitor + active 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_1.xml b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_1.xml index 8b3697f4a0..ef82c1b7ed 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_1.xml +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_1.xml @@ -13,6 +13,7 @@ Non Crystal CPNs, CAN Airspeed + active 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_2.xml b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_2.xml index a762c47472..882ed542ad 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_2.xml +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_2.xml @@ -14,6 +14,7 @@ CAN GPS, CAN Airspeed + active 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_3.xml b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_3.xml index c334ec568a..6fa557e2af 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_3.xml +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/aircraft_configuration/Volanti_AC_3.xml @@ -14,6 +14,7 @@ CAN GPS, CAN Airspeed + active 1