Fix symlink chain caching for Ubuntu 24.04 restore

This commit is contained in:
copilot-swe-agent[bot] 2026-06-13 23:53:03 +00:00 committed by GitHub
parent a151194b21
commit dd861124da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 91 additions and 4 deletions

View file

@ -925,6 +925,77 @@ jobs:
version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_106
debug: ${{ env.DEBUG }}
regression_156_install:
needs: [build_binaries]
runs-on: ubuntu-24.04
name: "Restore ffmpegthumbnailer shared libraries (regression issue #156, install phase)."
steps:
- uses: actions/checkout@v3.1.0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: cache-apt-pkgs-*
path: distribute-artifacts
- name: Setup distribute directory
shell: bash
run: |
mkdir -p distribute/X64 distribute/X86 distribute/ARM64 distribute/ARM
for artifact_dir in distribute-artifacts/cache-apt-pkgs-*; do
if [ -d "$artifact_dir" ]; then
arch=$(basename "$artifact_dir" | sed 's/cache-apt-pkgs-\([^-]*\)-.*/\1/')
echo "Copying artifacts for architecture: $arch"
cp -r "$artifact_dir"/* "distribute/$arch/" 2>/dev/null || true
fi
done
ls -la distribute/*/ || true
- uses: ./
with:
packages: ffmpegthumbnailer
version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_156
execute_install_scripts: true
debug: ${{ env.DEBUG }}
regression_156_restore:
needs: [regression_156_install, build_binaries]
runs-on: ubuntu-24.04
name: "Restore ffmpegthumbnailer shared libraries (regression issue #156, restore phase)."
steps:
- uses: actions/checkout@v3.1.0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: cache-apt-pkgs-*
path: distribute-artifacts
- name: Setup distribute directory
shell: bash
run: |
mkdir -p distribute/X64 distribute/X86 distribute/ARM64 distribute/ARM
for artifact_dir in distribute-artifacts/cache-apt-pkgs-*; do
if [ -d "$artifact_dir" ]; then
arch=$(basename "$artifact_dir" | sed 's/cache-apt-pkgs-\([^-]*\)-.*/\1/')
echo "Copying artifacts for architecture: $arch"
cp -r "$artifact_dir"/* "distribute/$arch/" 2>/dev/null || true
fi
done
ls -la distribute/*/ || true
- name: Execute
id: execute
uses: ./
with:
packages: ffmpegthumbnailer
version: ${{ github.run_id }}-${{ github.run_attempt }}-regression_156
execute_install_scripts: true
debug: ${{ env.DEBUG }}
- name: Verify cache hit
if: steps.execute.outputs.cache-hit != 'true'
run: |
echo "cache-hit = ${{ steps.execute.outputs.cache-hit }}"
exit 1
shell: bash
- name: Verify binary
run: ffmpegthumbnailer -h > /dev/null
shell: bash
multi_arch_cache_key:
needs: [build_binaries]
runs-on: ubuntu-latest

View file

@ -105,10 +105,26 @@ for installed_package in ${installed_packages}; do
if test -f "${f}" -o -L "${f}"; then
get_tar_relpath "${f}"
if [ -L "${f}" ]; then
target="$(readlink -f "${f}")"
if [ -f "${target}" ]; then
get_tar_relpath "${target}"
fi
symlink_path="${f}"
for i in $(seq 1 40); do
if [ ! -L "${symlink_path}" ]; then
break
fi
target="$(readlink "${symlink_path}")"
if [ "${target:0:1}" = "/" ]; then
target_path="${target}"
else
target_path="$(dirname "${symlink_path}")/${target}"
fi
if [ -f "${target_path}" ] || [ -L "${target_path}" ]; then
get_tar_relpath "${target_path}"
symlink_path="${target_path}"
else
break
fi
done
fi
fi
done