Prefer Native Shell on supported Linux installations

This commit is contained in:
Kevin Yue committed 2026-11-20 22:00:51 +08:00
1 parent 4ba50ca945
commit d81b1dc3ec
37 files changed
+869 -250

No files matched your search

+12 -2
View File
@@ -5,10 +5,11 @@ cd "$root"
temp=$(mktemp -d)
trap 'rm -rf "$temp"' EXIT HUP INT TERM
mkdir -p "$temp/release"
for binary in gpclient gpauth gpservice gpgui gpgui-helper gp-vpnc-script-installer gp-hip-script-installer; do
for binary in gpclient gpauth gpservice gpgui gpgui-nsh gpgui-helper gp-vpnc-script-installer gp-hip-script-installer; do
printf '#!/bin/sh\nexit 0\n' > "$temp/release/$binary"
chmod 755 "$temp/release/$binary"
done
echo 'ICU4X license fixture' > "$temp/release/ICU4X-LICENSE.txt"
mkdir -p "$temp/client-release"
cp "$temp/release/gpclient" "$temp/client-release/"
make install-gpclient-unix PREFIX='/custom/gp install' DESTDIR="$temp/client-stage" \
@@ -19,7 +20,7 @@ test -x "$installed/libexec/gpclient/vpnc-script"
test "$(find "$installed" -type f | wc -l | tr -d ' ')" = 2
for platform in linux bsd; do
stage="$temp/$platform-stage"
make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" \
make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" INCLUDE_GUI=1 NSH_BUNDLE_DIR="$temp/release" \
CARGO_RELEASE_DIR="$temp/release" GPGUI_BINARY="$temp/release/gpgui" > "$temp/$platform.log"
installed="$stage/custom/gp"
test -x "$installed/bin/gpclient"
@@ -35,8 +36,11 @@ for platform in linux bsd; do
! grep -F "$stage" "$installed/share/applications/gpgui.desktop"
if [ "$platform" = bsd ]; then
test ! -d "$installed/lib/NetworkManager"
test ! -e "$installed/bin/gpgui-nsh"
else
test -x "$installed/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down"
test -x "$installed/bin/gpgui-nsh"
cmp "$temp/release/ICU4X-LICENSE.txt" "$installed/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt"
fi
runtime="$stage/var/lib/gpclient"
if [ "$platform" = bsd ]; then
@@ -60,6 +64,12 @@ for platform in linux bsd; do
test -f "$installed/libexec/gpclient/unrelated"
test -f "$runtime/scripts/unrelated"
done
if make install-linux INCLUDE_GUI=1 PREFIX=/usr DESTDIR="$temp/missing-nsh" \
GPGUI_BINARY="$temp/release/gpgui" NSH_BUNDLE_DIR="$temp/absent" \
CARGO_RELEASE_DIR="$temp/release" > "$temp/missing-nsh.log" 2>&1; then
echo 'FAIL: bundled package installation succeeded without Native Shell' >&2
exit 1
fi
mv "$temp/release/gpclient" "$temp/release/gpclient.saved"
if make install-linux PREFIX=/custom/gp DESTDIR="$temp/missing-client-stage" \
CARGO_RELEASE_DIR="$temp/release" > "$temp/missing-client.log" 2>&1; then
@@ -45,3 +45,4 @@ check_authorization() {
check_authorization "$package_path/bin/gpclient" launch-gui --minimized
check_authorization "$package_path/bin/gpclient" --lock-file "$test_workspace/client.lock" launch-gui
check_authorization "$package_path/bin/gpgui" --minimized
check_authorization "$package_path/bin/gpgui-nsh" --minimized
+41 -1
View File
@@ -1,3 +1,4 @@
import hashlib
import importlib.util
import json
import os
@@ -80,7 +81,7 @@ class ReleaseVersionTests(unittest.TestCase):
write_version(root, '3.2.0')
package = root / 'result'
(package / 'bin').mkdir(parents=True)
for name in ('gpclient', 'gpservice', 'gpauth', 'gpgui'):
for name in ('gpclient', 'gpservice', 'gpauth', 'gpgui', 'gpgui-nsh'):
tool = package / 'bin' / name
tool.write_text(f'#!/bin/sh\necho "{name} 3.2.0 (PRIVATE_IDENTITY)"\n')
tool.chmod(0o755)
@@ -90,6 +91,44 @@ class ReleaseVersionTests(unittest.TestCase):
versions.validate(root, package=package)
class LinuxNshAssetsTests(unittest.TestCase):
def test_releases_require_both_architectures_and_libcs_with_matching_checksums(self):
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
assets = []
for arch in ('x86_64', 'aarch64'):
for suffix in ('', '-musl'):
directory = root / f'artifact-gpgui-nsh{suffix}-{arch}'
directory.mkdir()
archive = directory / f'gpgui-nsh_{arch}{suffix}.bin.tar.xz'
archive.write_bytes(archive.name.encode())
sidecar = archive.with_name(archive.name + '.sha256')
sidecar.write_text(hashlib.sha256(archive.read_bytes()).hexdigest() + '\n')
assets.extend((archive, sidecar))
for channel in ('snapshot', 'v3.7.0'):
command = [ROOT / 'scripts/release-assets.sh', channel, root]
valid = subprocess.run(command, capture_output=True, text=True, check=True)
self.assertEqual(set(valid.stdout.splitlines()), {str(asset) for asset in assets})
for asset in assets:
data = asset.read_bytes()
asset.unlink()
self.assertNotEqual(subprocess.run(command, capture_output=True).returncode, 0, asset.name)
asset.write_bytes(data)
archive = assets[0]
data = archive.read_bytes()
archive.write_bytes(b'corrupt')
self.assertNotEqual(subprocess.run(command, capture_output=True).returncode, 0)
archive.write_bytes(data)
for asset in assets:
asset.rename(root / asset.name)
verify_published = [ROOT / 'scripts/verify-linux-nsh-assets.sh', root]
subprocess.run(verify_published, capture_output=True, check=True)
(root / assets[-1].name).unlink()
self.assertNotEqual(subprocess.run(verify_published, capture_output=True).returncode, 0)
class BuildIdentityTests(unittest.TestCase):
def test_retry_uses_original_sources_after_both_branches_advance(self):
with tempfile.TemporaryDirectory() as temp:
@@ -145,6 +184,7 @@ class PromotionTests(unittest.TestCase):
initialize(repo)
write_version(repo)
hashes = 'gpguiHashes = { x86_64 = "old-gui-x64"; aarch64 = "old-gui-arm64"; };\n' \
'nshHashes = { x86_64 = "old-nsh-x64"; aarch64 = "old-nsh-arm64"; };\n' \
'binaryHashes = { x86_64 = "old-cli-x64"; aarch64 = "old-cli-arm64"; };\n'
with (repo / 'flake.nix').open('a') as flake:
flake.write('packageSetting = "original";\n' + hashes)