Skip to content

Commit 1bad623

Browse files
committed
fix(packaging): fix glob expansion and missing HOME fallback
Fix glob in px4-gazebo.sh that could match multiple arch directories by using find instead of shell glob. Add /tmp fallback when HOME is unset in main.cpp to avoid writing to filesystem root. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
1 parent ce8e143 commit 1bad623

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.github/actions/build-deb/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ runs:
2323
uses: actions/cache/restore@v4
2424
with:
2525
path: ~/.ccache
26-
key: ${{ inputs.ccache-key-prefix }}-${{ github.sha }}
26+
key: ${{ inputs.ccache-key-prefix }}-${{ github.ref_name }}-${{ github.sha }}
2727
restore-keys: |
28+
${{ inputs.ccache-key-prefix }}-${{ github.ref_name }}-
29+
${{ inputs.ccache-key-prefix }}-${{ github.base_ref || 'main' }}-
2830
${{ inputs.ccache-key-prefix }}-
2931
3032
- name: Configure ccache
@@ -35,6 +37,9 @@ runs:
3537
echo "compression = true" >> ~/.ccache/ccache.conf
3638
echo "compression_level = 6" >> ~/.ccache/ccache.conf
3739
echo "max_size = ${{ inputs.ccache-max-size }}" >> ~/.ccache/ccache.conf
40+
echo "hash_dir = false" >> ~/.ccache/ccache.conf
41+
echo "compiler_check = content" >> ~/.ccache/ccache.conf
42+
ccache -s
3843
ccache -z
3944
4045
- name: Build PX4 SITL
@@ -51,7 +56,7 @@ runs:
5156
if: always()
5257
with:
5358
path: ~/.ccache
54-
key: ${{ inputs.ccache-key-prefix }}-${{ github.sha }}
59+
key: ${{ inputs.ccache-key-prefix }}-${{ github.ref_name }}-${{ github.sha }}
5560

5661
- name: Build .deb package
5762
shell: bash

Tools/packaging/px4-gazebo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export GZ_SIM_SERVER_CONFIG_PATH="${PX4_GZ_SERVER_CONFIG}"
1818
# to the unversioned libgz-physics-dartsim-plugin.so. The runtime package only
1919
# ships versioned .so files; the unversioned symlink lives in the -dev package.
2020
# Create it if missing so Gazebo finds the DART engine without installing -dev.
21-
GZ_PHYSICS_ENGINE_DIR=$(echo /usr/lib/*/gz-physics-7/engine-plugins)
22-
if [ -d "$GZ_PHYSICS_ENGINE_DIR" ]; then
21+
GZ_PHYSICS_ENGINE_DIR=$(find /usr/lib -maxdepth 3 -type d -name "engine-plugins" -path "*/gz-physics-7/*" 2>/dev/null | head -1)
22+
if [ -n "$GZ_PHYSICS_ENGINE_DIR" ] && [ -d "$GZ_PHYSICS_ENGINE_DIR" ]; then
2323
UNVERSIONED="$GZ_PHYSICS_ENGINE_DIR/libgz-physics-dartsim-plugin.so"
2424
if [ ! -e "$UNVERSIONED" ]; then
2525
VERSIONED=$(ls "$GZ_PHYSICS_ENGINE_DIR"/libgz-physics*-dartsim-plugin.so.* 2>/dev/null | head -1)

platforms/posix/src/px4/common/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int main(int argc, char **argv)
276276

277277
} else {
278278
const char *home = getenv("HOME");
279-
state_base = std::string(home ? home : "") + "/.local/share";
279+
state_base = std::string(home ? home : "/tmp") + "/.local/share";
280280
}
281281

282282
working_directory = state_base + "/px4/rootfs";

0 commit comments

Comments
 (0)