Skip to content

Commit 71a0c66

Browse files
matteiusclaude
andcommitted
Fix .deb library extraction by replacing docker export with docker cp
The docker export | tar --wildcards approach broke when Docker/BuildKit changed the tar path prefix format, causing all .deb package builds to fail with "libuv not found in extracted libraries". Replace with docker cp to extract /usr/lib contents into a temp dir and pick out the four bundled libraries (libuv, llhttp, sqlite3, libsod). docker cp already works reliably for binary extraction in the same workflow. Note: Docker arm/v7 and arm64 builds fail separately due to systemd postinst crashing (SIGSEGV) under QEMU emulation — an upstream Debian sid issue unrelated to this change. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5f2d9df commit 71a0c66

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

.github/workflows/debian-package.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,30 +106,32 @@ jobs:
106106
docker cp "${CID}:/bin/go2rtc" "${PKG_DIR}/usr/bin/go2rtc"
107107
108108
# Custom-built libraries (bundle to guarantee ABI compatibility)
109-
# Include both 'usr/lib/…' and './usr/lib/…' variants because
110-
# docker export may prefix paths with './' depending on version.
111-
# All custom libs live under /usr/lib/ in the image (on usrmerge
112-
# systems /lib is a symlink to /usr/lib, so libsod also lands there).
109+
# Use docker cp to extract /usr/lib into a temp dir, then pick
110+
# out only the bundled libraries we need. This replaces the
111+
# fragile "docker export | tar --wildcards" approach which broke
112+
# when Docker/BuildKit changed the tar path prefix format.
113113
mkdir -p /tmp/lightnvr_libs
114-
docker export "${CID}" | tar xf - --wildcards \
115-
'usr/lib/libuv.so*' './usr/lib/libuv.so*' \
116-
'usr/lib/libllhttp.so*' './usr/lib/libllhttp.so*' \
117-
'usr/lib/libsqlite3.so*' './usr/lib/libsqlite3.so*' \
118-
'usr/lib/libsod.so*' './usr/lib/libsod.so*' \
119-
-C /tmp/lightnvr_libs/ 2>/dev/null || true
114+
docker cp "${CID}:/usr/lib/." /tmp/lightnvr_libs/
115+
echo "=== Bundled library candidates ==="
116+
ls -la /tmp/lightnvr_libs/lib{uv,llhttp,sqlite3,sod}* 2>/dev/null || true
120117
121-
find /tmp/lightnvr_libs -type f -name '*.so*' ! -type l \
122-
-exec install -m 644 {} "${PKG_DIR}/usr/lib/lightnvr/" \;
123-
124-
# Verify that all expected libraries were extracted
125118
for expected_lib in libuv libllhttp libsqlite3 libsod; do
126-
if ! ls "${PKG_DIR}/usr/lib/lightnvr/${expected_lib}.so"* >/dev/null 2>&1; then
119+
found=0
120+
for f in /tmp/lightnvr_libs/${expected_lib}.so*; do
121+
# Only install real files, not symlinks (we recreate symlinks below)
122+
if [ -f "$f" ] && [ ! -L "$f" ]; then
123+
install -m 644 "$f" "${PKG_DIR}/usr/lib/lightnvr/"
124+
found=1
125+
fi
126+
done
127+
if [ "$found" -eq 0 ]; then
127128
echo "ERROR: ${expected_lib} not found in extracted libraries!"
128-
echo "Contents of /tmp/lightnvr_libs:"
129-
find /tmp/lightnvr_libs -type f -name '*.so*' 2>/dev/null
129+
echo "Available .so files in /tmp/lightnvr_libs/:"
130+
ls /tmp/lightnvr_libs/*.so* 2>/dev/null | head -30
130131
exit 1
131132
fi
132133
done
134+
rm -rf /tmp/lightnvr_libs
133135
134136
# Recreate soname symlink chains inside the package directory
135137
# (Docker COPY dereferences symlinks, so we must recreate them)

0 commit comments

Comments
 (0)