about summary refs log tree commit diff
path: root/pkgs/applications/office
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2024-01-06 15:35:23 +0100
committerGitHub <noreply@github.com>2024-01-06 15:35:23 +0100
commitbf19d8166f705cbb69943eb18ca8355d5e6d43de (patch)
treeb167aa12e7c9dd35e5707550826827583f15da2d /pkgs/applications/office
parentcedb9fbcf1ebb46247e563cb3e989b42939e5237 (diff)
parentca5dd20ddec01ea26210133cddab9ea74381a816 (diff)
Merge pull request #275378 from nevivurn/feat/gnucash-55
gnucash: 5.4 -> 5.5
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r--pkgs/applications/office/gnucash/default.nix17
-rwxr-xr-xpkgs/applications/office/gnucash/update.sh24
2 files changed, 30 insertions, 11 deletions
diff --git a/pkgs/applications/office/gnucash/default.nix b/pkgs/applications/office/gnucash/default.nix
index 7c378bc52a90d..b7929dbf9e443 100644
--- a/pkgs/applications/office/gnucash/default.nix
+++ b/pkgs/applications/office/gnucash/default.nix
@@ -28,13 +28,12 @@
 
 stdenv.mkDerivation rec {
   pname = "gnucash";
-  version = "5.4";
+  version = "5.5";
 
   # raw source code doesn't work out of box; fetchFromGitHub not usable
   src = fetchurl {
-    # Upstream uploaded a -1 tarball on the same release, remove on next release
-    url = "https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}-1.tar.bz2";
-    hash = "sha256-d0EWXW1lLqe0oehJjPQ5pWuBpcyLZTKRpZBU8jYqv8w=";
+    url = "https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}.tar.bz2";
+    hash = "sha256-tNr2e7iStwYyP2Lp+pckIDnX3QouHhB3HgwlgX3Q7Ts=";
   };
 
   nativeBuildInputs = [
@@ -77,12 +76,6 @@ stdenv.mkDerivation rec {
     ./0003-remove-valgrind.patch
     # this patch makes gnucash exec the Finance::Quote wrapper directly
     ./0004-exec-fq-wrapper.patch
-    # this patch fixes a test that fails due to a type error, remove on next release
-    (fetchpatch {
-      name = "0005-utest-gnc-pricedb-fix.patch";
-      url = "https://github.com/Gnucash/gnucash/commit/0bd556c581ac462ca41b3cb533323fc3587051e1.patch";
-      hash = "sha256-k0ANZuOkWrtU4q380oDu/hC9PeGmujF49XEFQ8eCLGM=";
-    })
   ];
 
   # this needs to be an environment variable and not a cmake flag to suppress
@@ -106,7 +99,7 @@ stdenv.mkDerivation rec {
       owner = "Gnucash";
       repo = "gnucash-docs";
       rev = version;
-      hash = "sha256-aPxQEcpo8SPv8lPQbxMl1wg8ijH9Rz0oo4K5lp3C/bw=";
+      hash = "sha256-ilDh4PH+tdrJReIpgvEd0Gvs8Xvt5Q43XM5r7Bn+5IM=";
     };
 
     nativeBuildInputs = [ cmake ];
@@ -138,6 +131,8 @@ stdenv.mkDerivation rec {
       --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}"
   '';
 
+  passthru.updateScript = ./update.sh;
+
   meta = with lib; {
     homepage = "https://www.gnucash.org/";
     description = "Free software for double entry accounting";
diff --git a/pkgs/applications/office/gnucash/update.sh b/pkgs/applications/office/gnucash/update.sh
new file mode 100755
index 0000000000000..b339fd4a7c7c1
--- /dev/null
+++ b/pkgs/applications/office/gnucash/update.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -I nixpkgs=./. -i bash -p curl jq nix-prefetch-github
+
+set -euo pipefail
+
+latest_version=$(curl -s https://api.github.com/repos/Gnucash/gnucash/releases/latest | jq -r '.tag_name')
+
+if [[ "$latest_version" = "$UPDATE_NIX_OLD_VERSION" ]]; then
+    echo "already up to date"
+    exit 0
+fi
+
+old_src_hash=$(nix-instantiate --eval -A gnucash.src.outputHash | tr -d '"')
+old_src_doc_hash=$(nix-instantiate --eval -A gnucash.docs.src.outputHash | tr -d '"')
+
+src_hash=$(nix-prefetch-url "https://github.com/Gnucash/gnucash/releases/download/$latest_version/gnucash-$latest_version.tar.bz2")
+src_hash=$(nix-hash --to-sri --type sha256 "$src_hash")
+src_doc_hash=$(nix-prefetch-github Gnucash gnucash-docs --rev "$latest_version" | jq -r .hash)
+src_doc_hash=$(nix-hash --to-sri --type sha256 "$src_doc_hash")
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+sed -i default.nix -e "s|$old_src_hash|$src_hash|"
+sed -i default.nix -e "s|$old_src_doc_hash|$src_doc_hash|"
+sed -i default.nix -e "/ version =/s|\"${UPDATE_NIX_OLD_VERSION}\"|\"${latest_version}\"|"