Skip to content

Commit

Permalink
sauce-connect: 4.5.4 -> 4.9.1
Browse files Browse the repository at this point in the history
Latest version on Linux is actually 4.9.2, but latest on Mac is 4.9.1,
so only updating to 4.9.1 for consistency between the two.

Also added passthru.updateScript to keep this package up to date in the
future, with associated refactoring to make that possible.

(cherry picked from commit d31e17f)
  • Loading branch information
chasecaleb authored and github-actions[bot] committed Dec 10, 2023
1 parent c126db1 commit a89925b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 16 deletions.
36 changes: 20 additions & 16 deletions pkgs/development/tools/sauce-connect/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

stdenv.mkDerivation rec {
pname = "sauce-connect";
version = "4.5.4";

src = fetchurl (
if stdenv.hostPlatform.system == "x86_64-linux" then {
url = "https://saucelabs.com/downloads/sc-${version}-linux.tar.gz";
sha256 = "1w8fw47q4bzpk5jfagmc0cbp69jdd6jcv2xl1gx91cbp7xd8mcbf";
} else if stdenv.hostPlatform.system == "i686-linux" then {
url = "https://saucelabs.com/downloads/sc-${version}-linux32.tar.gz";
sha256 = "1h9n1mzmrmlrbd0921b0sgg7m8z0w71pdb5sif6h1b9f97cp353x";
} else {
url = "https://saucelabs.com/downloads/sc-${version}-osx.zip";
sha256 = "0rkyd402f1n92ad3w1460j1a4m46b29nandv4z6wvg2pasyyf2lj";
}
);
version = "4.9.1";

passthru = {
sources = {
x86_64-linux = fetchurl {
url = "https://saucelabs.com/downloads/sc-${version}-linux.tar.gz";
hash = "sha256-S3vzng6b0giB6Zceaxi62pQOEHysIR/vVQmswkEZ0/M=";
};
x86_64-darwin = fetchurl {
url = "https://saucelabs.com/downloads/sc-${version}-osx.zip";
hash = "sha256-6tJayqo+p7PMz8M651ikHz6tEjGjRIffOqQBchkpW5Q=";
};
aarch64-darwin = passthru.sources.x86_64-darwin;
};
};

src = passthru.sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");

nativeBuildInputs = [ unzip ];

Expand All @@ -38,7 +42,7 @@ stdenv.mkDerivation rec {
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
homepage = "https://docs.saucelabs.com/reference/sauce-connect/";
maintainers = with maintainers; [offline];
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ offline ];
platforms = builtins.attrNames passthru.sources;
};
}
27 changes: 27 additions & 0 deletions pkgs/development/tools/sauce-connect/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl jq
# API documentation: https://docs.saucelabs.com/dev/api/connect/

set -Eeuo pipefail
shopt -s lastpipe
die() {
echo -e "${BASH_SOURCE[0]}:${BASH_LINENO[0]}" ERROR: "$@" >&2
exit 1
}
# shellcheck disable=2154
trap 's=$?; die "$BASH_COMMAND"; exit $s' ERR

# Versions may not be updated simultaneously across all platforms, so need to figure out the latest
# version that includes both platforms. For example, currently the latest on Linux is 4.9.2 while
# Mac is 4.9.1.
response=$(curl -fsSL 'https://api.us-west-1.saucelabs.com/rest/v1/public/tunnels/info/versions?all=true')
all_versions=$(jq --exit-status --raw-output \
'.all_downloads | to_entries[] | select(.value | has("linux") and has("osx")) | .key' \
<<< "$response")
latest_version=$(sort --version-sort <<< "$all_versions" | tail -n 1)
for platform in x86_64-linux x86_64-darwin; do
update-source-version sauce-connect 0 "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" \
--source-key="passthru.sources.$platform"
update-source-version sauce-connect "$latest_version" \
--source-key="passthru.sources.$platform"
done

0 comments on commit a89925b

Please sign in to comment.