Files
DeepSeek-Reasonix/scripts/verify-linux-package.sh
SivanCola 8d406040e3 test(studio): strengthen Linux package and release verification
Problem: Studio packages need payload and installed-shell acceptance, and a
complete artifact gate before publication. Running the Electron and matrix
contracts on Windows also exposed host-dependent test fixtures.

Root cause: #12914 supplies native Linux ARM64 packaging but checks only Go
payload architectures and selected artifact names. The macOS bundle fixture
used the host OS's temporary path, and the matrix fixture relied on PATH
lookup for a mock git command instead of binding it in the tested shell.

Fix: Keep upstream native runners and system FPM, consolidate ELF checks,
verify both Linux package formats, exercise the installed shell, and require
all twelve nonempty release artifacts. Guard installation acceptance with
GITHUB_ACTIONS=true. Use platform-specific workspace fixtures and a shell
function for the matrix's git fixture, keeping all Windows test coverage.
Rebase on current studio and preserve adjacent release notes.

Verification: Electron 143 tests and Linux/script 39 tests pass, along with
workflow contracts, desktop Go tests, builtin/boot regressions, vet, lint,
repository checks, shell syntax and Actionlint. Previous-head hosted native
Linux package verification and installed acceptance passed for amd64/arm64;
replacement-head Windows CI remains the platform acceptance gate.

Refs #12906
2026-10-13 19:18:07 +08:00

36 lines
1.7 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
deb=${1:?usage: verify-linux-package.sh DEB RPM ARCH}
rpm=${2:?usage: verify-linux-package.sh DEB RPM ARCH}
arch=${3:?usage: verify-linux-package.sh DEB RPM ARCH}
case "$arch" in
amd64) rpm_arch=x86_64 ;;
arm64) rpm_arch=aarch64 ;;
*) echo "unsupported architecture: $arch" >&2; exit 1 ;;
esac
root=$(cd -- "$(dirname -- "$0")/.." && pwd)
stage=$(mktemp -d)
trap 'rm -rf -- "$stage"' EXIT
test "$(dpkg-deb -f "$deb" Package)" = reasonix-studio
test "$(dpkg-deb -f "$deb" Architecture)" = "$arch"
test "$(rpm -qp --qf '%{NAME}' "$rpm")" = reasonix-studio
test "$(rpm -qp --qf '%{ARCH}' "$rpm")" = "$rpm_arch"
dpkg-deb -c "$deb" > "$stage/deb-contents"
grep -qE '^-rwxr-xr-x (root/root|0/0) +[0-9]+ .* \./usr/lib/reasonix-studio/reasonix-studio-update-helper$' "$stage/deb-contents"
grep -qE '^-rw-r--r-- (root/root|0/0) +[0-9]+ .* \./usr/share/polkit-1/actions/io.reasonix.studio.update.policy$' "$stage/deb-contents"
rpm -qp --qf '[%{FILEMODES:perms} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]' "$rpm" > "$stage/rpm-contents"
grep -qx -- '-rwxr-xr-x root root /usr/lib/reasonix-studio/reasonix-studio-update-helper' "$stage/rpm-contents"
grep -qx -- '-rw-r--r-- root root /usr/share/polkit-1/actions/io.reasonix.studio.update.policy' "$stage/rpm-contents"
dpkg-deb -x "$deb" "$stage/deb"
mkdir "$stage/rpm"
rpm2cpio "$rpm" > "$stage/payload.cpio"
(cd "$stage/rpm" && cpio -idm --quiet --no-absolute-filenames < "$stage/payload.cpio")
for format in deb rpm; do
node "$root/desktop/electron/packaging/linux-tree.js" "$stage/$format" "$arch"
test "$("$stage/$format/usr/lib/reasonix-studio/reasonix-studio-update-helper" package)" = reasonix-studio
done