summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibault Gagnaux <tgagnaux@gmail.com>2022-05-25 21:35:11 +0200
committerThibault Gagnaux <tgagnaux@gmail.com>2022-05-27 17:28:30 +0200
commit2fb0615a66d2d7bd4745aeec995645e7cb01411b (patch)
tree52debc55ed0f9211b22cfb9d7b5d9d74548ae198
parentd679ccc970b7847a3bf216a1456c99ec5a52f774 (diff)
downloadnixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar.gz
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar.bz2
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar.lz
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar.xz
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.tar.zst
nixpkgs-2fb0615a66d2d7bd4745aeec995645e7cb01411b.zip
libreoffice: add integration test and use `lib.fakeSha256`
-rw-r--r--pkgs/applications/office/libreoffice/darwin/darwin.nix7
-rw-r--r--pkgs/applications/office/libreoffice/darwin/update-test.nix5
-rw-r--r--pkgs/applications/office/libreoffice/darwin/update-utils.nix5
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 1bb1b0fc558..2228d6bbfe6 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 d77992263f3..994a923c556 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 71d8417e674..766e858e33e 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;
 }