mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
The packaging script only placed all_events.json.xz in an events/ subdirectory, but the firmware advertises the metadata URI at the board directory top level. New build targets added after the Jenkins-to-GHA migration had no legacy top-level copy, causing QGC to get a 404 when fetching component metadata. Fixes #26963 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
67 lines
2.8 KiB
Bash
Executable File
67 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
mkdir artifacts
|
|
cp **/**/*.px4 artifacts/ 2>/dev/null || true
|
|
cp **/**/*.elf artifacts/ 2>/dev/null || true
|
|
cp **/**/*.deb artifacts/ 2>/dev/null || true
|
|
for build_dir_path in build/*/ ; do
|
|
build_dir_path=${build_dir_path::${#build_dir_path}-1}
|
|
build_dir=${build_dir_path#*/}
|
|
mkdir -p artifacts/$build_dir
|
|
find artifacts/ -maxdepth 1 -type f -name "*$build_dir*"
|
|
# Airframe (NuttX: build root, SITL: docs/ subdirectory)
|
|
airframes_src=""
|
|
if [ -f "$build_dir_path/airframes.xml" ]; then
|
|
airframes_src="$build_dir_path/airframes.xml"
|
|
elif [ -f "$build_dir_path/docs/airframes.xml" ]; then
|
|
airframes_src="$build_dir_path/docs/airframes.xml"
|
|
fi
|
|
if [ -n "$airframes_src" ]; then
|
|
cp "$airframes_src" "artifacts/$build_dir/"
|
|
fi
|
|
# Parameters
|
|
cp $build_dir_path/parameters.xml artifacts/$build_dir/ 2>/dev/null || true
|
|
cp $build_dir_path/parameters.json artifacts/$build_dir/ 2>/dev/null || true
|
|
cp $build_dir_path/parameters.json.xz artifacts/$build_dir/ 2>/dev/null || true
|
|
# Actuators
|
|
cp $build_dir_path/actuators.json artifacts/$build_dir/ 2>/dev/null || true
|
|
cp $build_dir_path/actuators.json.xz artifacts/$build_dir/ 2>/dev/null || true
|
|
# Events
|
|
mkdir -p artifacts/$build_dir/events/
|
|
cp $build_dir_path/events/all_events.json.xz artifacts/$build_dir/events/ 2>/dev/null || true
|
|
# Also copy to top level: firmware advertises the metadata URI without the events/ subdirectory
|
|
# (see src/lib/component_information/CMakeLists.txt comp_metadata_events_uri_board)
|
|
cp $build_dir_path/events/all_events.json.xz artifacts/$build_dir/ 2>/dev/null || true
|
|
# SBOM
|
|
cp $build_dir_path/*.sbom.spdx.json artifacts/$build_dir/ 2>/dev/null || true
|
|
ls -la artifacts/$build_dir
|
|
echo "----------"
|
|
done
|
|
|
|
if [ -d artifacts/px4_sitl_default ]; then
|
|
# general metadata (used by Flight Review and other downstream consumers)
|
|
mkdir -p artifacts/_general/
|
|
# Airframe
|
|
if [ -f artifacts/px4_sitl_default/airframes.xml ]; then
|
|
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
|
|
else
|
|
echo "Error: expected 'artifacts/px4_sitl_default/airframes.xml' not found." >&2
|
|
exit 1
|
|
fi
|
|
# Parameters
|
|
cp artifacts/px4_sitl_default/parameters.xml artifacts/_general/
|
|
cp artifacts/px4_sitl_default/parameters.json artifacts/_general/
|
|
cp artifacts/px4_sitl_default/parameters.json.xz artifacts/_general/
|
|
# Actuators
|
|
cp artifacts/px4_sitl_default/actuators.json artifacts/_general/
|
|
cp artifacts/px4_sitl_default/actuators.json.xz artifacts/_general/
|
|
# Events
|
|
if [ -f artifacts/px4_sitl_default/events/all_events.json.xz ]; then
|
|
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
|
|
else
|
|
echo "Error: expected 'artifacts/px4_sitl_default/events/all_events.json.xz' not found." >&2
|
|
exit 1
|
|
fi
|
|
ls -la artifacts/_general/
|
|
fi
|