From 56fd1edeae20e1605b71f27c41bd1128ab5be110 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Mon, 21 Jul 2025 18:22:02 +0200 Subject: [PATCH] fix(bundler): Move AppRun to mirror (#13864) --- .changes/apprun-mirror.md | 5 +++ .../covector-version-or-publish-v1.yml | 43 ++++++++++++------- core/tauri-build/src/lib.rs | 10 ++--- core/tauri/src/test/mod.rs | 2 +- core/tauri/src/window.rs | 2 +- core/tests/app-updater/tests/update.rs | 2 +- tooling/bundler/src/bundle/category.rs | 3 +- tooling/bundler/src/bundle/common.rs | 20 +++------ tooling/bundler/src/bundle/linux/debian.rs | 26 +++++------ .../src/bundle/linux/templates/appimage | 2 +- tooling/bundler/src/bundle/path_utils.rs | 10 ++--- tooling/bundler/src/bundle/platform.rs | 4 +- tooling/bundler/src/bundle/settings.rs | 3 +- tooling/bundler/src/bundle/updater_bundle.rs | 2 +- tooling/bundler/src/bundle/windows/msi/wix.rs | 13 +++--- tooling/bundler/src/bundle/windows/nsis.rs | 3 +- tooling/cli/src/build.rs | 2 +- tooling/cli/src/info/env_system.rs | 2 +- 18 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 .changes/apprun-mirror.md diff --git a/.changes/apprun-mirror.md b/.changes/apprun-mirror.md new file mode 100644 index 000000000..404504b3a --- /dev/null +++ b/.changes/apprun-mirror.md @@ -0,0 +1,5 @@ +--- +tauri-bundler: patch:bug +--- + +The AppImage bundler now pulls the AppRun binaries from our GitHub mirror, fixing 404 errors. diff --git a/.github/workflows/covector-version-or-publish-v1.yml b/.github/workflows/covector-version-or-publish-v1.yml index 30f9d00bc..03c4bc5ed 100644 --- a/.github/workflows/covector-version-or-publish-v1.yml +++ b/.github/workflows/covector-version-or-publish-v1.yml @@ -18,30 +18,26 @@ jobs: matrix: project: - name: core - flags: '--manifest-path=./Cargo.toml --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test' + flags: "--manifest-path=./Cargo.toml --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test" - name: bundler - flags: '--manifest-path=./tooling/bundler/Cargo.toml' - toolchain: '1.71.0' + flags: "--manifest-path=./tooling/bundler/Cargo.toml" + toolchain: "1.71.0" - name: cli - flags: '--manifest-path=./tooling/cli/Cargo.toml' - toolchain: '1.71.0' + flags: "--manifest-path=./tooling/cli/Cargo.toml" + toolchain: "1.71.0" platform: - { target: x86_64-pc-windows-msvc, os: windows-latest, - toolchain: '1.61.0' + toolchain: "1.61.0", } - { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04, - toolchain: '1.60.0' - } - - { - target: x86_64-apple-darwin, - os: macos-13, - toolchain: '1.60.0' + toolchain: "1.60.0", } + - { target: x86_64-apple-darwin, os: macos-13, toolchain: "1.60.0" } steps: - uses: actions/checkout@v4 @@ -99,6 +95,21 @@ jobs: cargo update -p openssl --precise 0.10.66 cargo update -p openssl-sys --precise 0.9.103 cargo update -p cargo_toml --precise 0.15.2 + cargo update -p shared_child --precise 1.0.0 + cargo update -p libc:0.2 --precise 0.2.163 + cargo update -p os_pipe --precise 1.1.5 + + - name: Downgrade crates with MSRV conflict (bundler) + if: ${{ matrix.project.name != 'core' }} + env: + CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback + run: | + cd tooling/bundler + cargo update -p avif-serialize --precise 0.8.3 + cargo update -p zune-jpeg --precise 0.4.14 + cd ../cli + cargo update -p avif-serialize --precise 0.8.3 + cargo update -p zune-jpeg --precise 0.4.14 - name: install rust ${{ matrix.project.toolchain || matrix.platform.toolchain }} uses: dtolnay/rust-toolchain@master @@ -175,7 +186,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 16 - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" cache: yarn cache-dependency-path: tooling/*/yarn.lock @@ -194,7 +205,7 @@ jobs: CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }} with: token: ${{ secrets.GITHUB_TOKEN }} - command: 'version-or-publish' + command: "version-or-publish" createRelease: true recognizeContributors: true @@ -205,8 +216,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} branch: release/version-updates-v1 title: Apply Version Updates From Current Changes (v1) - commit-message: 'apply version updates' - labels: 'version updates' + commit-message: "apply version updates" + labels: "version updates" body: ${{ steps.covector.outputs.change }} - name: Trigger doc update diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 323d65f5c..839fa3b2d 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -128,7 +128,7 @@ fn copy_dir(from: &Path, to: &Path) -> Result<()> { // Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`. fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Result { - let src_name = format!("{}.framework", framework); + let src_name = format!("{framework}.framework"); let src_path = src_dir.join(&src_name); if src_path.exists() { copy_dir(&src_path, &dest_dir.join(&src_name))?; @@ -140,12 +140,8 @@ fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Resu // Copies the macOS application bundle frameworks to the target folder fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> { - std::fs::create_dir_all(dest_dir).with_context(|| { - format!( - "Failed to create frameworks output directory at {:?}", - dest_dir - ) - })?; + std::fs::create_dir_all(dest_dir) + .with_context(|| format!("Failed to create frameworks output directory at {dest_dir:?}"))?; for framework in frameworks.iter() { if framework.ends_with(".framework") { let src_path = PathBuf::from(framework); diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 6910f1c5e..8c171fd18 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -360,7 +360,7 @@ mod tests { }); app.run(|_app, event| { - println!("{:?}", event); + println!("{event:?}"); }); } } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index f42232ad4..5d5465345 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1996,7 +1996,7 @@ pub(crate) fn ipc_scope_not_found_error_message(label: &str, url: &str) -> Strin } pub(crate) fn ipc_scope_window_error_message(label: &str) -> String { - format!("Scope not defined for window `{}`. See https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess and https://docs.rs/tauri/1/tauri/scope/struct.IpcScope.html#method.configure_remote_access", label) + format!("Scope not defined for window `{label}`. See https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess and https://docs.rs/tauri/1/tauri/scope/struct.IpcScope.html#method.configure_remote_access") } pub(crate) fn ipc_scope_domain_error_message(url: &str) -> String { diff --git a/core/tests/app-updater/tests/update.rs b/core/tests/app-updater/tests/update.rs index ecebdf397..adbdc96ac 100644 --- a/core/tests/app-updater/tests/update.rs +++ b/core/tests/app-updater/tests/update.rs @@ -408,7 +408,7 @@ fn update_app_flow) -> (PathBuf, TauriVersion)>(build_app_ .unwrap_or_else(|_| panic!("failed to read signature file {}", signature_path.display())); let out_updater_path = - out_bundle_path.with_extension(format!("{}.{}", bundle_updater_ext, updater_zip_ext)); + out_bundle_path.with_extension(format!("{bundle_updater_ext}.{updater_zip_ext}")); (out_updater_path, signature) } else { diff --git a/tooling/bundler/src/bundle/category.rs b/tooling/bundler/src/bundle/category.rs index 33e209583..8d44ded9b 100644 --- a/tooling/bundler/src/bundle/category.rs +++ b/tooling/bundler/src/bundle/category.rs @@ -256,8 +256,7 @@ impl serde::de::Visitor<'_> for AppCategoryVisitor { match self.did_you_mean { Some(string) => write!( formatter, - "a valid app category string (did you mean \"{}\"?)", - string + "a valid app category string (did you mean \"{string}\"?)" ), None => write!(formatter, "a valid app category string"), } diff --git a/tooling/bundler/src/bundle/common.rs b/tooling/bundler/src/bundle/common.rs index 876304a90..37cd46ed0 100644 --- a/tooling/bundler/src/bundle/common.rs +++ b/tooling/bundler/src/bundle/common.rs @@ -72,14 +72,12 @@ pub fn copy_file(from: impl AsRef, to: impl AsRef) -> crate::Result< let to = to.as_ref(); if !from.exists() { return Err(crate::Error::GenericError(format!( - "{:?} does not exist", - from + "{from:?} does not exist" ))); } if !from.is_file() { return Err(crate::Error::GenericError(format!( - "{:?} is not a file", - from + "{from:?} is not a file" ))); } let dest_dir = to.parent().expect("No data in parent"); @@ -96,20 +94,17 @@ pub fn copy_file(from: impl AsRef, to: impl AsRef) -> crate::Result< pub fn copy_dir(from: &Path, to: &Path) -> crate::Result<()> { if !from.exists() { return Err(crate::Error::GenericError(format!( - "{:?} does not exist", - from + "{from:?} does not exist" ))); } if !from.is_dir() { return Err(crate::Error::GenericError(format!( - "{:?} is not a Directory", - from + "{from:?} is not a Directory" ))); } if to.exists() { return Err(crate::Error::GenericError(format!( - "{:?} already exists", - from + "{from:?} already exists" ))); } let parent = to.parent().expect("No data in parent"); @@ -154,7 +149,7 @@ impl CommandExt for Command { fn output_ok(&mut self) -> crate::Result { let program = self.get_program().to_string_lossy().into_owned(); - debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{} {}", acc, arg))); + debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}"))); self.stdout(Stdio::piped()); self.stderr(Stdio::piped()); @@ -210,8 +205,7 @@ impl CommandExt for Command { Ok(output) } else { Err(crate::Error::GenericError(format!( - "failed to run {}", - program + "failed to run {program}" ))) } } diff --git a/tooling/bundler/src/bundle/linux/debian.rs b/tooling/bundler/src/bundle/linux/debian.rs index 167caf82d..00f6c26cb 100644 --- a/tooling/bundler/src/bundle/linux/debian.rs +++ b/tooling/bundler/src/bundle/linux/debian.rs @@ -57,13 +57,13 @@ pub fn bundle_project(settings: &Settings) -> crate::Result> { settings.version_string(), arch ); - let package_name = format!("{}.deb", package_base_name); + let package_name = format!("{package_base_name}.deb"); let base_dir = settings.project_out_directory().join("bundle/deb"); let package_dir = base_dir.join(&package_base_name); if package_dir.exists() { fs::remove_dir_all(&package_dir) - .with_context(|| format!("Failed to remove old {}", package_base_name))?; + .with_context(|| format!("Failed to remove old {package_base_name}"))?; } let package_path = base_dir.join(&package_name); @@ -110,7 +110,7 @@ pub fn generate_data( for bin in settings.binaries() { let bin_path = settings.binary_path(bin); common::copy_file(&bin_path, bin_dir.join(bin.name())) - .with_context(|| format!("Failed to copy binary from {:?}", bin_path))?; + .with_context(|| format!("Failed to copy binary from {bin_path:?}"))?; } copy_resource_files(settings, &data_dir).with_context(|| "Failed to copy resource files")?; @@ -135,7 +135,7 @@ fn generate_changelog_file(settings: &Settings, data_dir: &Path) -> crate::Resul if let Some(changelog_src_path) = &settings.deb().changelog { let mut src_file = File::open(changelog_src_path)?; let bin_name = settings.main_binary_name(); - let dest_path = data_dir.join(format!("usr/share/doc/{}/changelog.gz", bin_name)); + let dest_path = data_dir.join(format!("usr/share/doc/{bin_name}/changelog.gz")); let changelog_file = common::create_file(&dest_path)?; let mut gzip_encoder = GzEncoder::new(changelog_file, Compression::new(9)); @@ -160,16 +160,16 @@ fn generate_control_file( let mut file = common::create_file(&dest_path)?; writeln!(file, "Package: {}", AsKebabCase(settings.product_name()))?; writeln!(file, "Version: {}", settings.version_string())?; - writeln!(file, "Architecture: {}", arch)?; + writeln!(file, "Architecture: {arch}")?; // Installed-Size must be divided by 1024, see https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size writeln!(file, "Installed-Size: {}", total_dir_size(data_dir)? / 1024)?; let authors = settings.authors_comma_separated().unwrap_or_default(); - writeln!(file, "Maintainer: {}", authors)?; + writeln!(file, "Maintainer: {authors}")?; if let Some(section) = &settings.deb().section { - writeln!(file, "Section: {}", section)?; + writeln!(file, "Section: {section}")?; } if let Some(priority) = &settings.deb().priority { - writeln!(file, "Priority: {}", priority)?; + writeln!(file, "Priority: {priority}")?; } else { writeln!(file, "Priority: optional")?; } @@ -215,13 +215,13 @@ fn generate_control_file( if long_description.is_empty() { long_description = "(none)"; } - writeln!(file, "Description: {}", short_description)?; + writeln!(file, "Description: {short_description}")?; for line in long_description.lines() { let line = line.trim(); if line.is_empty() { writeln!(file, " .")?; } else { - writeln!(file, " {}", line)?; + writeln!(file, " {line}")?; } } file.flush()?; @@ -243,14 +243,14 @@ fn generate_md5sums(control_dir: &Path, data_dir: &Path) -> crate::Result<()> { let mut hash = md5::Context::new(); io::copy(&mut file, &mut hash)?; for byte in hash.compute().iter() { - write!(md5sums_file, "{:02x}", byte)?; + write!(md5sums_file, "{byte:02x}")?; } let rel_path = path.strip_prefix(data_dir)?; let path_str = rel_path.to_str().ok_or_else(|| { - let msg = format!("Non-UTF-8 path: {:?}", rel_path); + let msg = format!("Non-UTF-8 path: {rel_path:?}"); io::Error::new(io::ErrorKind::InvalidData, msg) })?; - writeln!(md5sums_file, " {}", path_str)?; + writeln!(md5sums_file, " {path_str}")?; } Ok(()) } diff --git a/tooling/bundler/src/bundle/linux/templates/appimage b/tooling/bundler/src/bundle/linux/templates/appimage index 9d1308a02..b0665d1e6 100644 --- a/tooling/bundler/src/bundle/linux/templates/appimage +++ b/tooling/bundler/src/bundle/linux/templates/appimage @@ -47,7 +47,7 @@ find -L /usr/lib* -name WebKitNetworkProcess -exec mkdir -p "$(dirname '{}')" \; find -L /usr/lib* -name WebKitWebProcess -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true find -L /usr/lib* -name libwebkit2gtkinjectedbundle.so -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true -( cd "{{tauri_tools_path}}" && ( wget -q -4 -N https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -N https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH} ) ) +( cd "{{tauri_tools_path}}" && ( wget -q -4 -N https://github.com/tauri-apps/binary-releases/releases/download/apprun-old/AppRun-{arch} || wget -q -4 -N https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH} ) ) chmod +x "{{tauri_tools_path}}/AppRun-${ARCH}" # We need AppRun to be installed as {{app_name}}.AppDir/AppRun. diff --git a/tooling/bundler/src/bundle/path_utils.rs b/tooling/bundler/src/bundle/path_utils.rs index ebd6284a4..227788c79 100644 --- a/tooling/bundler/src/bundle/path_utils.rs +++ b/tooling/bundler/src/bundle/path_utils.rs @@ -105,7 +105,7 @@ where let from = from.as_ref(); if !from.exists() { if let Some(msg) = from.to_str() { - let msg = format!("Path \"{}\" does not exist or you don't have access", msg); + let msg = format!("Path \"{msg}\" does not exist or you don't have access"); return Err(crate::Error::PathUtilError(msg)); } return Err(crate::Error::PathUtilError( @@ -115,7 +115,7 @@ where if !from.is_file() { if let Some(msg) = from.to_str() { - let msg = format!("Path \"{}\" is not a file!", msg); + let msg = format!("Path \"{msg}\" is not a file!"); return Err(crate::Error::PathUtilError(msg)); } return Err(crate::Error::PathUtilError( @@ -128,7 +128,7 @@ where } if let Some(msg) = to.as_ref().to_str() { - let msg = format!("Path \"{}\" is exist", msg); + let msg = format!("Path \"{msg}\" is exist"); return Err(crate::Error::PathUtilError(msg)); } } @@ -146,7 +146,7 @@ where let from = from.as_ref(); if !from.exists() { if let Some(msg) = from.to_str() { - let msg = format!("Path \"{}\" does not exist or you don't have access!", msg); + let msg = format!("Path \"{msg}\" does not exist or you don't have access!"); return Err(crate::Error::PathUtilError(msg)); } return Err(crate::Error::PathUtilError( @@ -155,7 +155,7 @@ where } if !from.is_dir() { if let Some(msg) = from.to_str() { - let msg = format!("Path \"{}\" is not a directory!", msg); + let msg = format!("Path \"{msg}\" is not a directory!"); return Err(crate::Error::PathUtilError(msg)); } return Err(crate::Error::PathUtilError( diff --git a/tooling/bundler/src/bundle/platform.rs b/tooling/bundler/src/bundle/platform.rs index 4a13d13b6..e1f1c16af 100644 --- a/tooling/bundler/src/bundle/platform.rs +++ b/tooling/bundler/src/bundle/platform.rs @@ -95,10 +95,10 @@ pub fn target_triple() -> Result { ))); }; - format!("{}-{}", os, env) + format!("{os}-{env}") }; - Ok(format!("{}-{}", arch, os)) + Ok(format!("{arch}-{os}")) } #[cfg(test)] diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index 293a4707d..ee3644cb2 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -810,8 +810,7 @@ impl Settings { "windows" => vec![PackageType::WindowsMsi, PackageType::Nsis], os => { return Err(crate::Error::GenericError(format!( - "Native {} bundles not yet supported.", - os + "Native {os} bundles not yet supported." ))) } }; diff --git a/tooling/bundler/src/bundle/updater_bundle.rs b/tooling/bundler/src/bundle/updater_bundle.rs index d3480e925..630822d50 100644 --- a/tooling/bundler/src/bundle/updater_bundle.rs +++ b/tooling/bundler/src/bundle/updater_bundle.rs @@ -195,7 +195,7 @@ fn bundle_update_windows(settings: &Settings, bundles: &[Bundle]) -> crate::Resu p.push(c); (p, b) }); - let archived_path = archived_path.with_extension(format!("{}.zip", bundle_name)); + let archived_path = archived_path.with_extension(format!("{bundle_name}.zip")); info!(action = "Bundling"; "{}", display_path(&archived_path)); diff --git a/tooling/bundler/src/bundle/windows/msi/wix.rs b/tooling/bundler/src/bundle/windows/msi/wix.rs index 43f67e395..31eb8d7fd 100644 --- a/tooling/bundler/src/bundle/windows/msi/wix.rs +++ b/tooling/bundler/src/bundle/windows/msi/wix.rs @@ -135,7 +135,7 @@ impl ResourceDirectory { directories.push_str(wix_string.as_str()); } let wix_string = if self.name.is_empty() { - format!("{}{}", files, directories) + format!("{files}{directories}") } else { format!( r#"{files}{directories}"#, @@ -186,8 +186,7 @@ fn app_installer_output_path( "aarch64" => "arm64", target => { return Err(crate::Error::ArchError(format!( - "Unsupported architecture: {}", - target + "Unsupported architecture: {target}" ))) } }; @@ -299,8 +298,7 @@ fn run_candle( "aarch64" => "arm64", target => { return Err(crate::Error::ArchError(format!( - "unsupported target: {}", - target + "unsupported target: {target}" ))) } }; @@ -394,8 +392,7 @@ pub fn build_wix_app_installer( "aarch64" => "arm64", target => { return Err(crate::Error::ArchError(format!( - "unsupported target: {}", - target + "unsupported target: {target}" ))) } }; @@ -758,7 +755,7 @@ pub fn build_wix_app_installer( let locale_contents = locale_contents.replace( "", - &format!("{}", unset_locale_strings), + &format!("{unset_locale_strings}"), ); let locale_path = output_path.join("locale.wxl"); { diff --git a/tooling/bundler/src/bundle/windows/nsis.rs b/tooling/bundler/src/bundle/windows/nsis.rs index 3776efb43..4483d9b1b 100644 --- a/tooling/bundler/src/bundle/windows/nsis.rs +++ b/tooling/bundler/src/bundle/windows/nsis.rs @@ -161,8 +161,7 @@ fn build_nsis_app_installer( "aarch64" => "arm64", target => { return Err(crate::Error::ArchError(format!( - "unsupported target: {}", - target + "unsupported target: {target}" ))) } }; diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index ee58b62ff..68f310ca8 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -358,7 +358,7 @@ fn run_hook(name: &str, hook: HookCommand, interface: &AppInterface, debug: bool .current_dir(cwd) .envs(env) .piped() - .with_context(|| format!("failed to run `{}` with `cmd /C`", script))?; + .with_context(|| format!("failed to run `{script}` with `cmd /C`"))?; #[cfg(not(target_os = "windows"))] let status = Command::new("sh") .arg("-c") diff --git a/tooling/cli/src/info/env_system.rs b/tooling/cli/src/info/env_system.rs index bc7ea3cc5..5f2fe49b1 100644 --- a/tooling/cli/src/info/env_system.rs +++ b/tooling/cli/src/info/env_system.rs @@ -194,7 +194,7 @@ pub fn items() -> Vec { ); webview2_version() .map(|v| { - v.map(|v| (format!("WebView2: {}", v), Status::Success)) + v.map(|v| (format!("WebView2: {v}"), Status::Success)) .unwrap_or_else(|| (error.clone(), Status::Error)) }) .unwrap_or_else(|_| (error, Status::Error)).into()