libreoffice: add integration test and use lib.fakeSha256

This commit is contained in:
Thibault Gagnaux 2022-05-25 21:35:11 +02:00
parent d679ccc970
commit 2fb0615a66
No known key found for this signature in database
GPG Key ID: 44BD0764ACAE8E25
3 changed files with 8 additions and 9 deletions

View File

@ -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
'';

View File

@ -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";

View File

@ -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;
}