From bb436d12e076d4625e971712f32f57b69d65aba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Wed, 18 Dec 2024 14:28:36 -0800 Subject: [PATCH 1/2] feat: support XDG_CONFIG_HOME Adapted from commit authored by Brennan Fee --- cargo-dist/templates/installer/installer.ps1.j2 | 6 +++++- cargo-dist/templates/installer/installer.sh.j2 | 2 +- cargo-dist/tests/gallery/dist/powershell.rs | 1 + cargo-dist/tests/gallery/dist/shell.rs | 1 + cargo-dist/tests/snapshots/akaikatana_basic.snap | 8 ++++++-- cargo-dist/tests/snapshots/akaikatana_musl.snap | 2 +- ...akaikatana_one_alias_among_many_binaries.snap | 8 ++++++-- .../snapshots/akaikatana_two_bin_aliases.snap | 8 ++++++-- .../tests/snapshots/akaikatana_updaters.snap | 8 ++++++-- cargo-dist/tests/snapshots/axolotlsay_abyss.snap | 8 ++++++-- .../tests/snapshots/axolotlsay_abyss_only.snap | 8 ++++++-- cargo-dist/tests/snapshots/axolotlsay_alias.snap | 8 ++++++-- .../axolotlsay_alias_ignores_missing_bins.snap | 8 ++++++-- cargo-dist/tests/snapshots/axolotlsay_basic.snap | 8 ++++++-- .../tests/snapshots/axolotlsay_basic_lies.snap | 8 ++++++-- .../snapshots/axolotlsay_build_setup_steps.snap | 8 ++++++-- .../snapshots/axolotlsay_checksum_blake2b.snap | 2 +- .../snapshots/axolotlsay_checksum_blake2s.snap | 2 +- .../snapshots/axolotlsay_checksum_sha3_256.snap | 2 +- .../snapshots/axolotlsay_checksum_sha3_512.snap | 2 +- .../tests/snapshots/axolotlsay_cross1.snap | 8 ++++++-- .../tests/snapshots/axolotlsay_cross2.snap | 8 ++++++-- .../axolotlsay_disable_source_tarball.snap | 8 ++++++-- .../snapshots/axolotlsay_dist_url_override.snap | 8 ++++++-- .../snapshots/axolotlsay_edit_existing.snap | 8 ++++++-- .../axolotlsay_generic_workspace_basic.snap | 16 ++++++++++++---- .../snapshots/axolotlsay_homebrew_packages.snap | 8 ++++++-- cargo-dist/tests/snapshots/axolotlsay_musl.snap | 2 +- .../tests/snapshots/axolotlsay_musl_no_gnu.snap | 2 +- .../axolotlsay_no_homebrew_publish.snap | 8 ++++++-- .../snapshots/axolotlsay_several_aliases.snap | 8 ++++++-- .../axolotlsay_ssldotcom_windows_sign.snap | 8 ++++++-- .../axolotlsay_ssldotcom_windows_sign_prod.snap | 8 ++++++-- .../tests/snapshots/axolotlsay_updaters.snap | 8 ++++++-- .../axolotlsay_user_global_build_job.snap | 8 ++++++-- .../snapshots/axolotlsay_user_host_job.snap | 8 ++++++-- .../axolotlsay_user_local_build_job.snap | 8 ++++++-- .../snapshots/axolotlsay_user_plan_job.snap | 8 ++++++-- .../snapshots/axolotlsay_user_publish_job.snap | 8 ++++++-- .../tests/snapshots/install_path_cargo_home.snap | 8 ++++++-- .../snapshots/install_path_env_no_subdir.snap | 8 ++++++-- .../tests/snapshots/install_path_env_subdir.snap | 8 ++++++-- .../snapshots/install_path_env_subdir_space.snap | 8 ++++++-- .../install_path_env_subdir_space_deeper.snap | 8 ++++++-- .../install_path_fallback_no_env_var_set.snap | 8 ++++++-- .../install_path_home_subdir_deeper.snap | 8 ++++++-- .../snapshots/install_path_home_subdir_min.snap | 8 ++++++-- .../install_path_home_subdir_space.snap | 8 ++++++-- .../install_path_home_subdir_space_deeper.snap | 8 ++++++-- .../install_path_no_fallback_taken.snap | 8 ++++++-- 50 files changed, 255 insertions(+), 89 deletions(-) diff --git a/cargo-dist/templates/installer/installer.ps1.j2 b/cargo-dist/templates/installer/installer.ps1.j2 index 853a82283..98a2b063e 100644 --- a/cargo-dist/templates/installer/installer.ps1.j2 +++ b/cargo-dist/templates/installer/installer.ps1.j2 @@ -72,7 +72,11 @@ if ($env:INSTALLER_DOWNLOAD_URL) { $receipt = @" {{ receipt | tojson }} "@ -$receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}" +if ($env:XDG_CONFIG_HOME) { + $receipt_home = "${env:XDG_CONFIG_HOME}\{{ app_name }}" +} else { + $receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}" +} if ($env:{{ env_vars.disable_update_env_var }}) { $install_updater = $false diff --git a/cargo-dist/templates/installer/installer.sh.j2 b/cargo-dist/templates/installer/installer.sh.j2 index 9a9ab1599..0e4f092c7 100644 --- a/cargo-dist/templates/installer/installer.sh.j2 +++ b/cargo-dist/templates/installer/installer.sh.j2 @@ -54,7 +54,7 @@ fi read -r RECEIPT < Date: Thu, 19 Dec 2024 14:22:13 -0800 Subject: [PATCH 2/2] feat: bump min required axoupdater --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- cargo-dist/src/lib.rs | 2 +- cargo-dist/tests/cli-tests.rs | 2 ++ 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dac2be9bb..d6a040f40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,9 +216,9 @@ dependencies = [ [[package]] name = "axoupdater" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70b7d3a9ea86ef8d17dada23f2c42518ed4b75dd6a8ff761f8988b448db8454" +checksum = "bc194af960a8ddbc4f28be3fa14f8716aa22141fe40bf1762ae0948defadcce4" dependencies = [ "axoasset", "axoprocess", @@ -230,7 +230,7 @@ dependencies = [ "self-replace", "serde", "tempfile", - "thiserror 1.0.69", + "thiserror 2.0.8", "url", ] diff --git a/Cargo.toml b/Cargo.toml index a54576235..200c69a20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ axoproject = { version = "=0.26.1", path = "axoproject", default-features = fals # first-party deps axocli = { version = "0.2.0" } -axoupdater = { version = "0.8.2" } +axoupdater = { version = "0.9.0" } axotag = "0.2.0" axoasset = { version = "1.2.0", features = ["json-serde", "toml-serde", "toml-edit", "yaml-serde", "compression", "remote"] } axoprocess = { version = "0.2.0" } diff --git a/cargo-dist/src/lib.rs b/cargo-dist/src/lib.rs index f25ce8dca..b82f5ee1e 100644 --- a/cargo-dist/src/lib.rs +++ b/cargo-dist/src/lib.rs @@ -255,7 +255,7 @@ fn run_build_step( } const AXOUPDATER_ASSET_ROOT: &str = "https://github.com/axodotdev/axoupdater/releases"; -const AXOUPDATER_MINIMUM_VERSION: &str = "0.7.0"; +const AXOUPDATER_MINIMUM_VERSION: &str = "0.9.0"; fn axoupdater_latest_asset_root() -> String { format!("{AXOUPDATER_ASSET_ROOT}/latest/download") diff --git a/cargo-dist/tests/cli-tests.rs b/cargo-dist/tests/cli-tests.rs index 6da035279..753c3b666 100644 --- a/cargo-dist/tests/cli-tests.rs +++ b/cargo-dist/tests/cli-tests.rs @@ -273,6 +273,8 @@ fn test_self_update() { .map(|s| s == "selfupdate" || s == "all") .unwrap_or(false) { + std::env::remove_var("XDG_CONFIG_HOME"); + let mut args = RuntestArgs { app_name: "cargo-dist".to_owned(), package: "cargo-dist".to_owned(),