upsun: 5.0.16 -> 5.0.21; add updateScript (#331473)

authored by

Aleksana and committed by
GitHub
cc2c0e99 d5909a6e

+69 -22
+21 -22
pkgs/by-name/up/upsun/package.nix
··· 3 lib, 4 fetchurl, 5 testers, 6 upsun 7 }: 8 9 stdenvNoCC.mkDerivation (finalAttrs: { 10 pname = "upsun"; 11 - version = "5.0.13"; 12 13 - src = 14 - { 15 - x86_64-darwin = fetchurl { 16 - url = "https://github.com/platformsh/cli/releases/download/${finalAttrs.version}/upsun_${finalAttrs.version}_darwin_all.tar.gz"; 17 - hash = "sha256-5JKXtAUnqrlufyNE05uZjEDfJv557auYPriTxvUbMJI="; 18 - }; 19 - aarch64-darwin = fetchurl { 20 - url = "https://github.com/platformsh/cli/releases/download/${finalAttrs.version}/upsun_${finalAttrs.version}_darwin_all.tar.gz"; 21 - hash = "sha256-5JKXtAUnqrlufyNE05uZjEDfJv557auYPriTxvUbMJI="; 22 - }; 23 - x86_64-linux = fetchurl { 24 - url = "https://github.com/platformsh/cli/releases/download/${finalAttrs.version}/upsun_${finalAttrs.version}_linux_amd64.tar.gz"; 25 - hash = "sha256-fjVL/sbO1wmaJ4qZpUMV/4Q4Jzf0p6qx0ElRdY5EUJU="; 26 - }; 27 - aarch64-linux = fetchurl { 28 - url = "https://github.com/platformsh/cli/releases/download/${finalAttrs.version}/upsun_${finalAttrs.version}_linux_arm64.tar.gz"; 29 - hash = "sha256-MNlQkwsg5SuIQJBDy7yVtcda1odpaUZezCgrat6OW2Q="; 30 - }; 31 - } 32 - .${stdenvNoCC.system} 33 - or (throw "${finalAttrs.pname}-${finalAttrs.version}: ${stdenvNoCC.system} is unsupported."); 34 35 dontConfigure = true; 36 dontBuild = true; ··· 41 42 install -Dm755 upsun $out/bin/upsun 43 44 runHook postInstall 45 ''; 46 47 passthru = { 48 tests.version = testers.testVersion { 49 inherit (finalAttrs) version; 50 package = upsun;
··· 3 lib, 4 fetchurl, 5 testers, 6 + installShellFiles, 7 upsun 8 }: 9 10 + let versions = lib.importJSON ./versions.json; 11 + arch = if stdenvNoCC.isx86_64 then "amd64" 12 + else if stdenvNoCC.isAarch64 then "arm64" 13 + else throw "Unsupported architecture"; 14 + os = if stdenvNoCC.isLinux then "linux" 15 + else if stdenvNoCC.isDarwin then "darwin" 16 + else throw "Unsupported os"; 17 + versionInfo = versions."${os}-${arch}"; 18 + inherit (versionInfo) hash url; 19 + 20 + in 21 stdenvNoCC.mkDerivation (finalAttrs: { 22 pname = "upsun"; 23 + inherit (versions) version; 24 25 + nativeBuildInputs = [ installShellFiles ]; 26 + 27 + # run ./update 28 + src = fetchurl { inherit hash url; }; 29 30 dontConfigure = true; 31 dontBuild = true; ··· 36 37 install -Dm755 upsun $out/bin/upsun 38 39 + installShellCompletion completion/bash/upsun.bash \ 40 + completion/zsh/_upsun 41 + 42 runHook postInstall 43 ''; 44 45 passthru = { 46 + updateScript = ./update.sh; 47 tests.version = testers.testVersion { 48 inherit (finalAttrs) version; 49 package = upsun;
+29
pkgs/by-name/up/upsun/update.sh
···
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl jq 3 + #shellcheck shell=bash 4 + 5 + set -eu -o pipefail 6 + 7 + version=$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \ 8 + https://api.github.com/repos/platformsh/cli/releases/latest | jq -e -r ".tag_name") 9 + 10 + linux_arm64_url=https://github.com/platformsh/cli/releases/download/$version/upsun_${version}_linux_arm64.tar.gz 11 + linux_amd64_url=https://github.com/platformsh/cli/releases/download/$version/upsun_${version}_linux_amd64.tar.gz 12 + darwin_all_url=https://github.com/platformsh/cli/releases/download/$version/upsun_${version}_darwin_all.tar.gz 13 + linux_arm64_hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$linux_arm64_url")) 14 + linux_amd64_hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$linux_amd64_url")) 15 + darwin_all_hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$darwin_all_url")) 16 + jq -n \ 17 + --arg version "$version" \ 18 + --arg darwin_all_hash "$darwin_all_hash" \ 19 + --arg darwin_all_url "$darwin_all_url" \ 20 + --arg linux_amd64_hash "$linux_amd64_hash" \ 21 + --arg linux_amd64_url "$linux_amd64_url" \ 22 + --arg linux_arm64_hash "$linux_arm64_hash" \ 23 + --arg linux_arm64_url "$linux_arm64_url" \ 24 + '{ "version": $version, 25 + "darwin-amd64": { "hash": $darwin_all_hash, "url": $darwin_all_url }, 26 + "darwin-arm64": { "hash": $darwin_all_hash, "url": $darwin_all_url }, 27 + "linux-amd64": { "hash": $linux_amd64_hash, "url": $linux_amd64_url }, 28 + "linux-arm64": { "hash": $linux_arm64_hash, "url": $linux_arm64_url } 29 + }' > pkgs/by-name/up/upsun/versions.json
+19
pkgs/by-name/up/upsun/versions.json
···
··· 1 + { 2 + "version": "5.0.21", 3 + "darwin-amd64": { 4 + "hash": "sha256-ePm8QOJcC87CqB1PbSAoMblopr7JsViHWW3BEQ+gjlQ=", 5 + "url": "https://github.com/platformsh/cli/releases/download/5.0.21/upsun_5.0.21_darwin_all.tar.gz" 6 + }, 7 + "darwin-arm64": { 8 + "hash": "sha256-ePm8QOJcC87CqB1PbSAoMblopr7JsViHWW3BEQ+gjlQ=", 9 + "url": "https://github.com/platformsh/cli/releases/download/5.0.21/upsun_5.0.21_darwin_all.tar.gz" 10 + }, 11 + "linux-amd64": { 12 + "hash": "sha256-1qbgXI3VtYoI/4EWPZ1jmWBVJEP+A60PIqXS38wnBPQ=", 13 + "url": "https://github.com/platformsh/cli/releases/download/5.0.21/upsun_5.0.21_linux_amd64.tar.gz" 14 + }, 15 + "linux-arm64": { 16 + "hash": "sha256-pUdRvVtEokuf7gznUogyufTtloy4MuT5TMcJ4z1bcwo=", 17 + "url": "https://github.com/platformsh/cli/releases/download/5.0.21/upsun_5.0.21_linux_arm64.tar.gz" 18 + } 19 + }