waveterm: fix hash mismatch (#357157)

This commit is contained in:
Weijia Wang 2024-11-23 14:23:43 +01:00 committed by GitHub
commit be3424c6ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 69 additions and 34 deletions

View File

@ -1,7 +1,9 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts
latestVersion=$(curl -s ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/bblanchon/pdfium-binaries/releases/latest | jq -r '.tag_name | ltrimstr("chromium/")')
set -eou pipefail
latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/bblanchon/pdfium-binaries/releases/latest | jq -r '.tag_name | ltrimstr("chromium/")')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; pdfium-binaries.version" | tr -d '"')
echo "latest version: $latestVersion"
@ -11,6 +13,7 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then
echo "package is up-to-date"
exit 0
fi
for i in \
"x86_64-linux linux-x64" \
"aarch64-linux linux-arm64" \

View File

@ -29,35 +29,14 @@
udev,
libGL,
fetchzip,
unzip,
}:
let
pname = "waveterm";
version = "0.9.2";
src =
let
inherit (stdenv.hostPlatform) system;
selectSystem = attrs: attrs.${system};
suffix = selectSystem {
x86_64-linux = "waveterm-linux-x64";
aarch64-linux = "waveterm-linux-arm64";
x86_64-darwin = "Wave-darwin-x64";
aarch64-darwin = "Wave-darwin-arm64";
};
hash = selectSystem {
x86_64-linux = "sha256-s6s/SfLNVwRN50OgqWTohHT8/rFuu4P3hpxfhA7kPOU=";
aarch64-linux = "sha256-dxQbTPvge3QY40rWKAOV/uuTPzHsfNk9USxICoF1CQM=";
x86_64-darwin = "sha256-/nedzsQxqLclK5uwOKZ/WgRwjoHDCxLuI+/T1B3cyJM=";
aarch64-darwin = "sha256-lBJEJHgBozrR+JF5jlbmuG2c0P19qmjJUhwlJtHqkRE=";
};
in
fetchzip {
url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip";
inherit hash;
stripRoot = false;
};
pname = "waveterm";
version = "0.9.3";
passthru.updateScript = ./update.sh;
desktopItems = [
@ -104,12 +83,28 @@ let
inherit
pname
version
src
desktopItems
meta
passthru
;
src =
let
suffix = selectSystem {
x86_64-linux = "waveterm-linux-x64";
aarch64-linux = "waveterm-linux-arm64";
};
hash = selectSystem {
x86_64-linux = "sha256-zmmWQnZklnmhVrZp0F0dkVHVMW+K/VynSvbF9Zer/RE=";
aarch64-linux = "sha256-HRZRRUV6CVqUQYuvXBmnNcAsbZwgNDZiEf+gjdLDaPQ=";
};
in
fetchzip {
url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip";
inherit hash;
stripRoot = false;
};
nativeBuildInputs = [
copyDesktopItems
autoPatchelfHook
@ -162,22 +157,49 @@ let
'';
};
darwin = stdenv.mkDerivation {
darwin = stdenv.mkDerivation rec {
inherit
pname
version
src
meta
passthru
;
src =
let
suffix = selectSystem {
x86_64-darwin = "Wave-darwin-x64";
aarch64-darwin = "Wave-darwin-arm64";
};
hash = selectSystem {
x86_64-darwin = "sha256-NSpNWUWdRkB2H5l/WnI/Xyv68h0OXX7SIKyDAq0LIJM=";
aarch64-darwin = "sha256-QkJMrmqrveFc2StL5gVpE78DlC1OBcEV+tY7p2nJ/6I=";
};
in
fetchurl {
url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip";
inherit hash;
};
nativeBuildInputs = [
unzip
];
unpackPhase = ''
runHook preUnpack
unzip ${src} -d ./
runHook postUnpack
'';
sourceRoot = "Wave.app";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications/Wave.app
cp -R . $out/Applications/Wave.app
cp -r . $out/Applications/Wave.app
runHook postInstall
'';

View File

@ -1,7 +1,9 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts
latestTag=$(curl -s ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/wavetermdev/waveterm/releases/latest | jq -r ".tag_name")
set -eou pipefail
latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/wavetermdev/waveterm/releases/latest | jq -r ".tag_name")
latestVersion="$(expr "$latestTag" : 'v\(.*\)')"
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; waveterm.version" | tr -d '"')
@ -12,13 +14,21 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then
echo "package is up-to-date"
exit 0
fi
for i in \
"x86_64-linux waveterm-linux-x64" \
"aarch64-linux waveterm-linux-arm64" \
"x86_64-darwin Wave-darwin-x64" \
"aarch64-darwin Wave-darwin-arm64"; do
"aarch64-linux waveterm-linux-arm64"; do
set -- $i
prefetch=$(nix-prefetch-url --unpack "https://github.com/wavetermdev/waveterm/releases/download/v$latestVersion/$2-$latestVersion.zip")
hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch)
update-source-version waveterm $latestVersion $hash --system=$1 --ignore-same-version
done
for i in \
"x86_64-darwin Wave-darwin-x64" \
"aarch64-darwin Wave-darwin-arm64"; do
set -- $i
prefetch=$(nix-prefetch-url "https://github.com/wavetermdev/waveterm/releases/download/v$latestVersion/$2-$latestVersion.zip")
hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch)
update-source-version waveterm $latestVersion $hash --system=$1 --ignore-same-version
done