From 982562874a170938b1393a0278bf81ab39ccc427 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sun, 22 Mar 2026 15:12:27 +0800 Subject: [PATCH] fix: update Rust version handling in PPA build scripts --- .github/workflows/publish-ppa.yaml | 4 ++-- Makefile | 11 ++++++++++- packaging/deb/control.in | 2 +- packaging/deb/rules.in | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-ppa.yaml b/.github/workflows/publish-ppa.yaml index ad5ffd3..cb184e2 100644 --- a/.github/workflows/publish-ppa.yaml +++ b/.github/workflows/publish-ppa.yaml @@ -82,8 +82,8 @@ jobs: sed -i "s/@BUILD_GUI_HELPER@/1/g" .build/debian/rules # Update the control file with the correct Rust version - # sed -i "s/rust-[0-9.]\+-all/rust-${{ inputs.rust }}-all/g" .build/debian/control - # sed -i "s/rust-[0-9.]\+/rust-${{ inputs.rust }}/g" .build/debian/rules + sed -i "s/@RUST_VERSION@/${{ inputs.rust }}/g" .build/debian/control + sed -i "s/@RUST_VERSION@/${{ inputs.rust }}/g" .build/debian/rules sed -i "s/DISABLE_RUST_TOOLCHAIN = 0/DISABLE_RUST_TOOLCHAIN = 1/g" .build/debian/rules - name: Publish to PPA diff --git a/Makefile b/Makefile index 57682b9..06b5f50 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ INCLUDE_GUI ?= 0 CARGO ?= cargo DISABLE_RUST_TOOLCHAIN ?= 0 +RUST_VERSION ?= 1.89 +IGNORE_RUST_VERSION ?= 0 VERSION = $(shell grep '^version' Cargo.toml | head -1 | sed 's/version *= *"\(.*\)"/\1/') REVISION ?= 1 @@ -38,6 +40,10 @@ ifeq ($(OFFLINE), 1) CARGO_BUILD_ARGS += --frozen endif +ifeq ($(IGNORE_RUST_VERSION), 1) + CARGO_BUILD_ARGS += --ignore-rust-version +endif + default: build version: @@ -170,7 +176,7 @@ init-debian: clean-debian tarball cp -f packaging/deb/postrm .build/deb/$(PKG)/debian/postrm cp -f packaging/deb/compat .build/deb/$(PKG)/debian/compat - sed -i "s/@BUILD_GUI_HELPER@/$(BUILD_GUI_HELPER)/g" .build/deb/$(PKG)/debian/rules + sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/control # Remove the GUI dependencies if BUILD_GUI_HELPER is set to 0 if [ $(BUILD_GUI_HELPER) -eq 0 ]; then \ @@ -180,6 +186,9 @@ init-debian: clean-debian tarball sed -i "/libwebkit2gtk-4.1-dev/d" .build/deb/$(PKG)/debian/control; \ fi + sed -i "s/@BUILD_GUI_HELPER@/$(BUILD_GUI_HELPER)/g" .build/deb/$(PKG)/debian/rules + sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/rules + rm -f .build/deb/$(PKG)/debian/changelog deb: init-debian diff --git a/packaging/deb/control.in b/packaging/deb/control.in index 3994391..7c92235 100644 --- a/packaging/deb/control.in +++ b/packaging/deb/control.in @@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 9), gnome-keyring, libwebkit2gtk-4.1-dev, libopenconnect-dev (>= 8.20), - rust-1.85-all + rust-@RUST_VERSION@-all Homepage: https://github.com/yuezk/GlobalProtect-openconnect Package: globalprotect-openconnect diff --git a/packaging/deb/rules.in b/packaging/deb/rules.in index 852308f..930ebff 100755 --- a/packaging/deb/rules.in +++ b/packaging/deb/rules.in @@ -3,7 +3,7 @@ export BUILD_GUI_HELPER = @BUILD_GUI_HELPER@ export DISABLE_RUST_TOOLCHAIN = 0 -export PATH := /usr/lib/rust-1.85/bin:$(PATH) +export PATH := /usr/lib/rust-@RUST_VERSION@/bin:$(PATH) %: which cargo