From 60ab1fd59320bcc8b7d47dbad05c15e8246b8353 Mon Sep 17 00:00:00 2001 From: Aria Beingessner Date: Tue, 19 Dec 2023 12:46:59 -0500 Subject: [PATCH] fix: don't respect cargo-dist's install hints for curl-sh exprs The dist-manifest.json fundamentally lacks the information to generate perfect pretty curl-sh exprs, because it needs to be uploaded before the create-release endpoint tells us this url format. As such, oranda should ignore the manifest for these install-hints, and instead use the inference backend for them, which can use the URLs returned by the list-releases endpoint (or the github release's base url). --- src/data/cargo_dist.rs | 5 +- tests/snapshots/gal_akaikatana-public.snap | 58 +++++++------- tests/snapshots/gal_axolotlsay-public.snap | 74 +++++++++--------- tests/snapshots/gal_oranda-public.snap | 90 +++++++++++----------- 4 files changed, 115 insertions(+), 112 deletions(-) diff --git a/src/data/cargo_dist.rs b/src/data/cargo_dist.rs index 4afe3aa3..7432ede1 100644 --- a/src/data/cargo_dist.rs +++ b/src/data/cargo_dist.rs @@ -61,11 +61,14 @@ impl ReleaseArtifacts { { preference = InstallerPreference::Custom; None + } else if id.ends_with(".sh") || id.ends_with(".ps1") { + // We have more info to do a better job than cargo-dist on + // `curl | sh` exprs, inference will handle this for us! + continue; } else { preference = InstallerPreference::Script; file }; - method = InstallMethod::Run { file, run_hint: install_hint.clone(), diff --git a/tests/snapshots/gal_akaikatana-public.snap b/tests/snapshots/gal_akaikatana-public.snap index 7113a3a0..3fefd6d9 100644 --- a/tests/snapshots/gal_akaikatana-public.snap +++ b/tests/snapshots/gal_akaikatana-public.snap @@ -73,9 +73,9 @@ expression: "&snapshots"

powershell

-irm https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex
+irm https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex - @@ -96,9 +96,9 @@ expression: "&snapshots"

shell

-curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh
+curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh - @@ -215,7 +215,7 @@ expression: "&snapshots" ================ public/artifacts.json ================ -{"format_version":"CENSORED","tag":"v0.2.0","formatted_date":"Aug 8 2023 at 16:03 UTC","platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[0,2]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[0,3]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[1,4]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[0,5]}],"downloadable_files":[[0,{"name":"akaikatana-repack-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Apple Silicon"]],[3,{"name":"akaikatana-repack-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Intel"]],[4,{"name":"akaikatana-repack-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},["Windows x64"]],[5,{"name":"akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux x64"]]],"release":{"artifacts":{"files":[{"name":"akaikatana-repack-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-installer.ps1","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1","view_path":"akaikatana-repack-installer.ps1.txt","checksum_file":null},{"name":"akaikatana-repack-installer.sh","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh","view_path":"akaikatana-repack-installer.sh.txt","checksum_file":null},{"name":"akaikatana-repack-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"dist-manifest.json","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/dist-manifest.json","view_path":null,"checksum_file":null}],"installers":[{"label":"shell","description":"Install prebuilt binaries via shell script","app_name":null,"method":{"type":"Run","file":2,"run_hint":"curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh"}},{"label":"powershell","description":"Install prebuilt binaries via powershell script","app_name":null,"method":{"type":"Run","file":1,"run_hint":"irm https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex"}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":0}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":3}},{"label":"zip","description":"","app_name":null,"method":{"type":"Download","file":4}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":5}}],"targets":{"aarch64-apple-darwin":[0,2],"x86_64-apple-darwin":[0,3],"x86_64-pc-windows-msvc":[1,4],"x86_64-unknown-linux-gnu":[0,5]}}},"os_script":"/akaikatana-repack/artifacts.js","has_checksum_files":false} +{"format_version":"CENSORED","tag":"v0.2.0","formatted_date":"Aug 8 2023 at 16:03 UTC","platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[5,0]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[5,1]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[4,2]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[5,3]}],"downloadable_files":[[0,{"name":"akaikatana-repack-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Apple Silicon"]],[3,{"name":"akaikatana-repack-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Intel"]],[4,{"name":"akaikatana-repack-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},["Windows x64"]],[5,{"name":"akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux x64"]]],"release":{"artifacts":{"files":[{"name":"akaikatana-repack-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-installer.ps1","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1","view_path":"akaikatana-repack-installer.ps1.txt","checksum_file":null},{"name":"akaikatana-repack-installer.sh","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh","view_path":"akaikatana-repack-installer.sh.txt","checksum_file":null},{"name":"akaikatana-repack-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},{"name":"akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"dist-manifest.json","download_url":"https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/dist-manifest.json","view_path":null,"checksum_file":null}],"installers":[{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":0}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":3}},{"label":"zip","description":"","app_name":null,"method":{"type":"Download","file":4}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":5}},{"label":"powershell","description":"","app_name":null,"method":{"type":"Run","file":1,"run_hint":"irm https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex"}},{"label":"shell","description":"","app_name":null,"method":{"type":"Run","file":2,"run_hint":"curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh"}}],"targets":{"aarch64-apple-darwin":[5,0],"aarch64-pc-windows-msvc":[4],"aarch64-unknown-linux-gnu":[5],"aarch64-unknown-linux-musl":[5],"i686-apple-darwin":[5],"i686-pc-windows-msvc":[4],"i686-unknown-linux-gnu":[5],"i686-unknown-linux-musl":[5],"x86_64-apple-darwin":[5,1],"x86_64-pc-windows-msvc":[4,2],"x86_64-unknown-linux-gnu":[5,3],"x86_64-unknown-linux-musl":[5]}}},"os_script":"/akaikatana-repack/artifacts.js","has_checksum_files":false} ================ public/changelog/index.html ================ @@ -548,7 +548,7 @@ expression: "&snapshots" -
  • +
  • shell @@ -556,7 +556,7 @@ expression: "&snapshots" -
  • +
  • tarball @@ -568,14 +568,14 @@ expression: "&snapshots"
      -
    • +
    • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh
      +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh - @@ -593,7 +593,7 @@ expression: "&snapshots"
    • -
    • +
    • shell @@ -626,7 +626,7 @@ expression: "&snapshots" -
    • +
    • tarball @@ -638,14 +638,14 @@ expression: "&snapshots"
        -
      • +
      • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh
        +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh - @@ -663,7 +663,7 @@ expression: "&snapshots"
      • -
      • +
      • powershell @@ -696,7 +696,7 @@ expression: "&snapshots" -
      • +
      • zip @@ -708,14 +708,14 @@ expression: "&snapshots"
          -
        • +
        • -irm https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex
          +irm https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.ps1 | iex - @@ -733,7 +733,7 @@ expression: "&snapshots"
        • -
        • +
        • shell @@ -766,7 +766,7 @@ expression: "&snapshots" -
        • +
        • tarball @@ -778,14 +778,14 @@ expression: "&snapshots"
            -
          • +
          • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mistydemeo/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh
            +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/akaikatana-repack/releases/download/v0.2.0/akaikatana-repack-installer.sh | sh - @@ -803,7 +803,7 @@ expression: "&snapshots"
          • -
          • +
          • shell @@ -688,7 +688,7 @@ expression: "&snapshots" -
          • +
          • npx @@ -696,7 +696,7 @@ expression: "&snapshots" -
          • +
          • tarball @@ -708,14 +708,14 @@ expression: "&snapshots"
              -
            • +
            • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh
              +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh - @@ -733,7 +733,7 @@ expression: "&snapshots"
            • - -
            • +
            • shell @@ -785,7 +785,7 @@ expression: "&snapshots" -
            • +
            • npx @@ -793,7 +793,7 @@ expression: "&snapshots" -
            • +
            • tarball @@ -805,14 +805,14 @@ expression: "&snapshots"
                -
              • +
              • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh
                +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh - @@ -830,7 +830,7 @@ expression: "&snapshots"
              • - -
              • +
              • powershell @@ -882,7 +882,7 @@ expression: "&snapshots" -
              • +
              • npx @@ -890,7 +890,7 @@ expression: "&snapshots" -
              • +
              • tarball @@ -902,14 +902,14 @@ expression: "&snapshots"
                  -
                • +
                • -irm https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.ps1 | iex
                  +irm https://github.com/oranda-gallery/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.ps1 | iex - @@ -927,7 +927,7 @@ expression: "&snapshots"
                • - -
                • +
                • shell @@ -979,7 +979,7 @@ expression: "&snapshots" -
                • +
                • npx @@ -987,7 +987,7 @@ expression: "&snapshots" -
                • +
                • tarball @@ -999,14 +999,14 @@ expression: "&snapshots"
                    -
                  • +
                  • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh
                    +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/axolotlsay/releases/download/v0.1.0/axolotlsay-installer.sh | sh - @@ -1024,7 +1024,7 @@ expression: "&snapshots"
                  • - -
                  • +
                  • shell @@ -1132,7 +1132,7 @@ one that it can't parse.

                    -
                  • +
                  • cargo @@ -1140,7 +1140,7 @@ one that it can't parse.

                    -
                  • +
                  • npm @@ -1148,7 +1148,7 @@ one that it can't parse.

                    -
                  • +
                  • tarball @@ -1160,14 +1160,14 @@ one that it can't parse.

                      -
                    • +
                    • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.2.0/oranda-installer.sh | sh
                      +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/oranda/releases/download/v0.2.0/oranda-installer.sh | sh - @@ -1185,7 +1185,7 @@ one that it can't parse.

                    • - - -
                    • +
                    • shell @@ -1256,7 +1256,7 @@ one that it can't parse.

                      -
                    • +
                    • cargo @@ -1264,7 +1264,7 @@ one that it can't parse.

                      -
                    • +
                    • npm @@ -1272,7 +1272,7 @@ one that it can't parse.

                      -
                    • +
                    • tarball @@ -1284,14 +1284,14 @@ one that it can't parse.

                        -
                      • +
                      • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.2.0/oranda-installer.sh | sh
                        +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/oranda/releases/download/v0.2.0/oranda-installer.sh | sh - @@ -1309,7 +1309,7 @@ one that it can't parse.

                      • - - -
                      • +
                      • powershell @@ -1380,7 +1380,7 @@ one that it can't parse.

                        -
                      • +
                      • cargo @@ -1388,7 +1388,7 @@ one that it can't parse.

                        -
                      • +
                      • npm @@ -1396,7 +1396,7 @@ one that it can't parse.

                        -
                      • +
                      • tarball @@ -1408,14 +1408,14 @@ one that it can't parse.

                          -
                        • +
                        • -irm https://github.com/axodotdev/oranda/releases/download/v0.2.0/oranda-installer.ps1 | iex
                          +irm https://github.com/oranda-gallery/oranda/releases/download/v0.2.0/oranda-installer.ps1 | iex - @@ -1433,7 +1433,7 @@ one that it can't parse.

                        • - - -
                        • +
                        • shell @@ -1504,7 +1504,7 @@ one that it can't parse.

                          -
                        • +
                        • cargo @@ -1512,7 +1512,7 @@ one that it can't parse.

                          -
                        • +
                        • npm @@ -1520,7 +1520,7 @@ one that it can't parse.

                          -
                        • +
                        • tarball @@ -1532,14 +1532,14 @@ one that it can't parse.

                            -
                          • +
                          • -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.2.0/oranda-installer.sh | sh
                            +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/oranda-gallery/oranda/releases/download/v0.2.0/oranda-installer.sh | sh - @@ -1557,7 +1557,7 @@ one that it can't parse.

                          • - - -