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 #!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts #!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 '"') currentVersion=$(nix-instantiate --eval -E "with import ./. {}; pdfium-binaries.version" | tr -d '"')
echo "latest version: $latestVersion" echo "latest version: $latestVersion"
@ -11,6 +13,7 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then
echo "package is up-to-date" echo "package is up-to-date"
exit 0 exit 0
fi fi
for i in \ for i in \
"x86_64-linux linux-x64" \ "x86_64-linux linux-x64" \
"aarch64-linux linux-arm64" \ "aarch64-linux linux-arm64" \

View File

@ -29,35 +29,14 @@
udev, udev,
libGL, libGL,
fetchzip, fetchzip,
unzip,
}: }:
let let
pname = "waveterm";
version = "0.9.2";
src =
let
inherit (stdenv.hostPlatform) system; inherit (stdenv.hostPlatform) system;
selectSystem = attrs: attrs.${system}; selectSystem = attrs: attrs.${system};
suffix = selectSystem { pname = "waveterm";
x86_64-linux = "waveterm-linux-x64"; version = "0.9.3";
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;
};
passthru.updateScript = ./update.sh; passthru.updateScript = ./update.sh;
desktopItems = [ desktopItems = [
@ -104,12 +83,28 @@ let
inherit inherit
pname pname
version version
src
desktopItems desktopItems
meta meta
passthru 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 = [ nativeBuildInputs = [
copyDesktopItems copyDesktopItems
autoPatchelfHook autoPatchelfHook
@ -162,22 +157,49 @@ let
''; '';
}; };
darwin = stdenv.mkDerivation { darwin = stdenv.mkDerivation rec {
inherit inherit
pname pname
version version
src
meta meta
passthru 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"; sourceRoot = "Wave.app";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/Applications/Wave.app mkdir -p $out/Applications/Wave.app
cp -R . $out/Applications/Wave.app cp -r . $out/Applications/Wave.app
runHook postInstall runHook postInstall
''; '';

View File

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