From 2fb0615a66d2d7bd4745aeec995645e7cb01411b Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 25 May 2022 21:35:11 +0200 Subject: libreoffice: add integration test and use `lib.fakeSha256` --- pkgs/applications/office/libreoffice/darwin/darwin.nix | 7 +++---- pkgs/applications/office/libreoffice/darwin/update-test.nix | 5 ++++- pkgs/applications/office/libreoffice/darwin/update-utils.nix | 5 +---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 1bb1b0fc55806..2228d6bbfe6fd 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -52,8 +52,7 @@ stdenvNoCC.mkDerivation { let inherit (import ./update-utils.nix { inherit lib; }) getLatestStableVersion - getSha256 - nullHash; + getSha256; newVersion = getLatestStableVersion; newAarch64Sha256 = getSha256 dist."aarch64-darwin".url version newVersion; newX86_64Sha256 = getSha256 dist."x86_64-darwin".url version newVersion; @@ -65,9 +64,9 @@ stdenvNoCC.mkDerivation { set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --system=aarch64-darwin update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin - update-source-version libreoffice 0 ${nullHash} --system=x86_64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --system=x86_64-darwin update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --system=x86_64-darwin ''; diff --git a/pkgs/applications/office/libreoffice/darwin/update-test.nix b/pkgs/applications/office/libreoffice/darwin/update-test.nix index d77992263f3f4..994a923c556dc 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-test.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-test.nix @@ -4,7 +4,8 @@ let inherit (import ./update-utils.nix { inherit (pkgs) lib; }) extractLatestVersionFromHtml - extractSha256FromHtml; + extractSha256FromHtml + getLatestStableVersion; in nixt.mkSuite "LibreOffice Updater" { @@ -38,6 +39,8 @@ nixt.mkSuite "LibreOffice Updater" in "7.3.3" == actual; + "should extract latest stable version from website" = (builtins.compareVersions getLatestStableVersion "7.3.3") >= 0; + "should extract sha256 from html" = let sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix index 71d8417e67470..766e858e33e2c 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-utils.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -39,8 +39,6 @@ let getSha256Url = dmgUrl: oldVersion: newVersion: (builtins.replaceStrings [ oldVersion ] [ newVersion ] dmgUrl) + ".sha256"; - # nullHash :: String - nullHash = "0000000000000000000000000000000000000000000000000000000000000000"; in { inherit @@ -49,6 +47,5 @@ in getLatestStableVersion extractSha256FromHtml getSha256 - getSha256Url - nullHash; + getSha256Url; } -- cgit 1.4.1