Fix .deb build: use fast compression, more aggressive cleanup

- Use dpkg-deb -Zxz -z1 for faster compression (large packages were hanging)
- Remove more unnecessary files: man pages, docs, locales, pkgconfig
- Add progress messages during bundle preparation
- Remove .la, .hpp, .pyo files
This commit is contained in:
forbes
2026-01-28 19:58:14 -06:00
parent b9d5dbd141
commit f424f0e499
2 changed files with 27 additions and 12 deletions

View File

@@ -145,32 +145,45 @@ jobs:
BUNDLE_DIR="build/release/bundle"
mkdir -p "${BUNDLE_DIR}"
# Copy the entire pixi/conda environment
echo "Copying pixi environment..."
cp -a .pixi/envs/default/* "${BUNDLE_DIR}/"
echo "Original size: $(du -sh ${BUNDLE_DIR} | cut -f1)"
# Remove unnecessary files to reduce size
# Remove unnecessary files to reduce size significantly
echo "Removing unnecessary files..."
rm -rf "${BUNDLE_DIR}/include"
rm -rf "${BUNDLE_DIR}/conda-meta"
rm -rf "${BUNDLE_DIR}/doc"
rm -rf "${BUNDLE_DIR}/man"
rm -rf "${BUNDLE_DIR}/share/doc"
rm -rf "${BUNDLE_DIR}/share/man"
rm -rf "${BUNDLE_DIR}/share/gtk-doc"
rm -rf "${BUNDLE_DIR}/share/info"
rm -rf "${BUNDLE_DIR}/lib/cmake"
find "${BUNDLE_DIR}" -name "*.a" -delete
find "${BUNDLE_DIR}" -name "*.h" -delete
find "${BUNDLE_DIR}" -name "*.cmake" -delete
find "${BUNDLE_DIR}" -path "*/__pycache__/*" -delete
find "${BUNDLE_DIR}" -name "*.pyc" -delete
rm -rf "${BUNDLE_DIR}/lib/pkgconfig"
rm -rf "${BUNDLE_DIR}/share/pkgconfig"
# Remove static libraries and dev files
find "${BUNDLE_DIR}" -name "*.a" -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.la" -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.h" -type f -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.hpp" -type f -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.cmake" -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -path "*/__pycache__/*" -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.pyc" -delete 2>/dev/null || true
find "${BUNDLE_DIR}" -name "*.pyo" -delete 2>/dev/null || true
# Keep only necessary binaries
if [ -d "${BUNDLE_DIR}/bin" ]; then
mv "${BUNDLE_DIR}/bin" "${BUNDLE_DIR}/bin_tmp"
mkdir "${BUNDLE_DIR}/bin"
for bin in FreeCAD FreeCADCmd freecad freecadcmd python python3 ccx gmsh dot pip; do
[ -f "${BUNDLE_DIR}/bin_tmp/${bin}" ] && cp "${BUNDLE_DIR}/bin_tmp/${bin}" "${BUNDLE_DIR}/bin/" || true
for bin in FreeCAD FreeCADCmd freecad freecadcmd python python3 python3.11 ccx gmsh dot pip pyside6-rcc; do
[ -f "${BUNDLE_DIR}/bin_tmp/${bin}" ] && cp -a "${BUNDLE_DIR}/bin_tmp/${bin}" "${BUNDLE_DIR}/bin/" || true
done
rm -rf "${BUNDLE_DIR}/bin_tmp"
fi
echo "Bundle size: $(du -sh ${BUNDLE_DIR} | cut -f1)"
echo "Final bundle size: $(du -sh ${BUNDLE_DIR} | cut -f1)"
- name: Build .deb package
shell: bash

View File

@@ -329,9 +329,11 @@ chmod 755 "${STAGING_DIR}/DEBIAN/postrm"
# Build the .deb package
# --root-owner-group ensures all files are owned by root:root (standard practice)
# -Zxz with -z1 uses fast compression (large packages can take very long with default settings)
mkdir -p "${OUTPUT_DIR}"
echo "Building package..."
dpkg-deb --build --root-owner-group "${STAGING_DIR}" "${OUTPUT_DIR}/${DEB_NAME}.deb"
echo "Building package (this may take a few minutes for large packages)..."
echo "Staging directory size: $(du -sh "${STAGING_DIR}" | cut -f1)"
dpkg-deb -Zxz -z1 --build --root-owner-group "${STAGING_DIR}" "${OUTPUT_DIR}/${DEB_NAME}.deb"
# Verify the package
echo "Verifying package..."