Improve DEB package extraction and repackaging logic

Enhanced the workflow to handle multiple data archive compression formats (xz, gz, zst) when extracting and repackaging DEB files. Added checks for the presence of the data archive and updated extraction and repackaging commands to match the detected format, improving robustness and compatibility.
This commit is contained in:
Your Name
2025-09-02 19:47:28 +03:00
parent aebe5f1aa6
commit 1b552c4ae8
+46 -4
View File
@@ -211,10 +211,41 @@ jobs:
# Extract the DEB package
ar x "$GITHUB_WORKSPACE/$deb_file"
# List extracted files to see what we have
echo "Extracted DEB contents:"
ls -la
# Find the data archive (could be data.tar.xz, data.tar.gz, data.tar.zst, etc.)
data_archive=""
for ext in xz gz zst; do
if [ -f "data.tar.$ext" ]; then
data_archive="data.tar.$ext"
break
fi
done
if [ -z "$data_archive" ]; then
echo "Warning: Could not find data archive in DEB package"
cd "$GITHUB_WORKSPACE"
rm -rf "$temp_deb_dir"
else
echo "Found data archive: $data_archive"
# Extract the data archive
mkdir -p data
cd data
tar xf ../data.tar.xz
case "$data_archive" in
*.tar.xz)
tar xf "../$data_archive"
;;
*.tar.gz)
tar xzf "../$data_archive"
;;
*.tar.zst)
tar --zstd -xf "../$data_archive"
;;
esac
# Ensure desktop files are properly placed
if [ ! -d "usr/share/applications" ]; then
@@ -236,12 +267,22 @@ jobs:
echo "Copied icon to proper location"
fi
# Repackage the data archive
tar cJf ../data.tar.xz ./*
# Repackage the data archive with the same compression
case "$data_archive" in
*.tar.xz)
tar cJf "../$data_archive" ./*
;;
*.tar.gz)
tar czf "../$data_archive" ./*
;;
*.tar.zst)
tar --zstd -cf "../$data_archive" ./*
;;
esac
cd ..
# Create the fixed DEB package
ar r "${GITHUB_WORKSPACE}/${deb_file}" debian-binary control.tar.xz data.tar.xz
ar r "${GITHUB_WORKSPACE}/${deb_file}" debian-binary control.tar.* "$data_archive"
# Clean up
cd "$GITHUB_WORKSPACE"
@@ -249,6 +290,7 @@ jobs:
echo "DEB package desktop integration fixed"
fi
fi
echo "Post-build directory listing:"
echo "-- dist --"; ls -lah dist || true